Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error CODEC2_MODE_1400 and CODEC2_MODE_450 undeclared #8

Closed
raoniluar opened this issue Oct 1, 2020 · 4 comments
Closed

error CODEC2_MODE_1400 and CODEC2_MODE_450 undeclared #8

raoniluar opened this issue Oct 1, 2020 · 4 comments

Comments

@raoniluar
Copy link

I'm using Ubuntu 18.04 and I tried to install pycodec2 in two different ways.

First, I installed codec2 with:

sudo apt install libcodec2-dev

Then, I tried to install pycodec2 with:

python3 setup.py install

And I get this error:

Collecting pycodec2
  Downloading https://files.pythonhosted.org/packages/a9/04/2002d37f184815f33bf7c7aa23227f4a522d4050497a27249dd47d91a435/pycodec2-1.0.4.tar.gz (64kB)
    100% |████████████████████████████████| 71kB 856kB/s 
Installing collected packages: pycodec2
  Running setup.py install for pycodec2 ... error
    Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-13hoywvk/pycodec2/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-d550qjrh-record/install-record.txt --single-version-externally-managed --compile:
    /usr/lib/python3.6/distutils/dist.py:261: UserWarning: Unknown distribution option: 'long_description_content_type'
      warnings.warn(msg)
    running install
    running build
    running build_py
    package init file 'pycodec2/__init__.py' not found (or not a regular file)
    running build_ext
    skipping 'pycodec2/pycodec2.c' Cython extension (up-to-date)
    building 'pycodec2' extension
    creating build
    creating build/temp.linux-x86_64-3.6
    creating build/temp.linux-x86_64-3.6/pycodec2
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/local/lib/python3.6/dist-packages/numpy/core/include -I/usr/include/python3.6m -c pycodec2/pycodec2.c -o build/temp.linux-x86_64-3.6/pycodec2/pycodec2.o
    In file included from /usr/local/lib/python3.6/dist-packages/numpy/core/include/numpy/ndarraytypes.h:1832:0,
                     from /usr/local/lib/python3.6/dist-packages/numpy/core/include/numpy/ndarrayobject.h:12,
                     from /usr/local/lib/python3.6/dist-packages/numpy/core/include/numpy/arrayobject.h:4,
                     from pycodec2/pycodec2.c:607:
    /usr/local/lib/python3.6/dist-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
     #warning "Using deprecated NumPy API, disable it with " \
      ^~~~~~~
    pycodec2/pycodec2.c: In function ‘__pyx_pymod_exec_pycodec2’:
    pycodec2/pycodec2.c:6766:36: error: ‘CODEC2_MODE_450’ undeclared (first use in this function); did you mean ‘CODEC2_MODE_1400’?
       __pyx_t_2 = __Pyx_PyInt_From_int(CODEC2_MODE_450); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 11, __pyx_L1_error)
                                        ^~~~~~~~~~~~~~~
                                        CODEC2_MODE_1400
    pycodec2/pycodec2.c:6766:36: note: each undeclared identifier is reported only once for each function it appears in
    pycodec2/pycodec2.c:6778:36: error: ‘CODEC2_MODE_450PWB’ undeclared (first use in this function); did you mean ‘CODEC2_MODE_450’?
       __pyx_t_2 = __Pyx_PyInt_From_int(CODEC2_MODE_450PWB); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 12, __pyx_L1_error)
                                        ^~~~~~~~~~~~~~~~~~
                                        CODEC2_MODE_450
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    
    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-13hoywvk/pycodec2/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-d550qjrh-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-13hoywvk/pycodec2/

When I use this command instead:

sudo pip3 install pycodec2

I get the same error before.

@gregorias
Copy link
Owner

I took a quick look and it seems to me that 18.04's codec2 library is too old (and there of incompatible) for the current pycodec2 version. 18.04 is at 0.7, while 450 mode was added in codec2-0.9.2.

Would it be possible for you to install a newer version of codec2? Alternatively you could fork pycodec2 and remove those incompatible modes. We could look into other options if these are infeasible.

@ghost
Copy link

ghost commented Oct 4, 2020

I've been running into this myself building Docker images.
Codec2 packages aren't getting promoted from testing repositories in many Linux distributions, it's not clear why but likely there's just not that much demand. Codec2 users on each distribution might offer to take up maintenance of the packages to ensure timely updates.

Specifying to pip a version of pycodec2 compatible with the system codec2 should be sufficient, right?
The hard part is mapping pycodec2 versions to system codec2 package versions, and that sort of thing.

In Ubuntu 18.04, I ran into a numpy issue using the pip numpy and had to use the system package manager to get numpy installed.

apt-get install libcodec2-0.7 libcodec2-dev python3 python3-pip python3-numpy gets you what you need as far as system dependencies.
pip3 install Cython and then pip3 install pycodec2==1.0.2 which is the last installable version from my brief testing.

@gregorias
Copy link
Owner

@mach327 That's a fair problem. I'll have to think about how to approach this. Cython's compile time conditionals look promising (not sure if they'll work with C macros). If that doesn't work, perhaps I could release backward compatible branches.

@gregorias
Copy link
Owner

gregorias commented Oct 4, 2020

I've published a special backward compatible version at PyPI. I've tested it locally and should work with codec2-0.7 but let me know if it doesn't.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants