Skip to content

Does not build when installed via Python3.7+ #27

@Jayjader

Description

@Jayjader

Attempting to install orderedset via pip in python3.7 and 3.8 fails with error containing message error: command 'gcc' failed with exit status 1.

Steps to reproduce (lines prefixed by $ contain the commands):

$ python3.7 -m venv venv37
$ ./venv37/bin/pip install orderedset
Collecting orderedset
  Downloading https://files.pythonhosted.org/packages/d6/04/04150a0fd248844e7265f14789f3b36493f8235a27de103d0f0f19a12f61/orderedset-2.0.2.tar.gz (79kB)
     |████████████████████████████████| 81kB 1.1MB/s
Installing collected packages: orderedset
  Running setup.py install for orderedset ... error
    ERROR: Command errored out with exit status 1:
     command: /tmp/venv37/bin/python3.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-laof2akp/orderedset/setup.py'"'"'; __file__='"'"'/tmp/pip-install-laof2akp/orderedset/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-record-tl7wjx11/install-record.txt --single-version-externally-managed --compile --install-headers /tmp/venv37/include/site/python3.7/orderedset
         cwd: /tmp/pip-install-laof2akp/orderedset/
    Complete output (39 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.7
    creating build/lib.linux-x86_64-3.7/orderedset
    copying lib/orderedset/__init__.py -> build/lib.linux-x86_64-3.7/orderedset
    running build_ext
    building 'orderedset._orderedset' extension
    creating build/temp.linux-x86_64-3.7
    creating build/temp.linux-x86_64-3.7/lib
    creating build/temp.linux-x86_64-3.7/lib/orderedset
    gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -march=x86-64 -mtune=generic -O3 -pipe -fno-plt -fPIC -I/tmp/venv37/include -I/usr/include/python3.7m -c lib/orderedset/_orderedset.c -o build/temp.linux-x86_64-3.7/lib/orderedset/_orderedset.o
    lib/orderedset/_orderedset.c: In function ‘__Pyx__ExceptionSwap’:
    lib/orderedset/_orderedset.c:13976:24: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
    13976 |     tmp_type = tstate->exc_type;
          |                        ^~~~~~~~
          |                        curexc_type
    lib/orderedset/_orderedset.c:13977:25: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
    13977 |     tmp_value = tstate->exc_value;
          |                         ^~~~~~~~~
          |                         curexc_value
    lib/orderedset/_orderedset.c:13978:22: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
    13978 |     tmp_tb = tstate->exc_traceback;
          |                      ^~~~~~~~~~~~~
          |                      curexc_traceback
    lib/orderedset/_orderedset.c:13979:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_type’; did you mean ‘curexc_type’?
    13979 |     tstate->exc_type = *type;
          |             ^~~~~~~~
          |             curexc_type
    lib/orderedset/_orderedset.c:13980:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_value’; did you mean ‘curexc_value’?
    13980 |     tstate->exc_value = *value;
          |             ^~~~~~~~~
          |             curexc_value
    lib/orderedset/_orderedset.c:13981:13: error: ‘PyThreadState’ {aka ‘struct _ts’} has no member named ‘exc_traceback’; did you mean ‘curexc_traceback’?
    13981 |     tstate->exc_traceback = *tb;
          |             ^~~~~~~~~~~~~
          |             curexc_traceback
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /tmp/venv37/bin/python3.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-laof2akp/orderedset/setup.py'"'"'; __file__='"'"'/tmp/pip-install-laof2akp/orderedset/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-record-tl7wjx11/install-record.txt --single-version-externally-managed --compile --install-headers /tmp/venv37/include/site/python3.7/orderedset Check the logs for full command output.

A quick search online yields these similar issues in other projects: 1 2, and in particular this comment seems to contain a possible fix.

The root idea appears to be that the cached C source files generated by Cython were not regenerated for release 2.0.2's enabling of use with python3.7 & 3.8, and thus contain symbols present in python3.6 but removed in 3.7 onwards. These cached files furthermore seem to be used when Cython is absent from the virtualenv. If Cython is already present, the C source files are generated on the spot, and seem to be compatible with the python version present (3.7 and 3.8).

Output in my terminal:

$ ./venv37/bin/pip install cython
Collecting cython
  Downloading https://files.pythonhosted.org/packages/17/49/5a2834a373417130b77d43b39a5a9a117d528e8d63ecb439555afef8b33d/Cython-0.29.15-cp37-cp37m-manylinux1_x86_64.whl (2.1MB)
     |████████████████████████████████| 2.1MB 2.0MB/s
Installing collected packages: cython
Successfully installed cython-0.29.15
$ ./venv37/bin/pip install orderedset
Collecting orderedset
  Using cached https://files.pythonhosted.org/packages/d6/04/04150a0fd248844e7265f14789f3b36493f8235a27de103d0f0f19a12f61/orderedset-2.0.2.tar.gz
Installing collected packages: orderedset
  Running setup.py install for orderedset ... done
Successfully installed orderedset-2.0.2

The apparent quick fix is to regenerate and republish the C source files to pypi.

Additionally, the comment I linked above mentions adding cython to the setup_requires argument to setup (sourcing this stackoverflow answer). However, I am unsure if this will work given discussion on other issues found on github, notably this comment.

For completeness's sake, installing with python3.8 fails with the same behavior, whereas using python3.6 succeeds.

Personal environment:

  • ArchLinux running kernel 5.5.5-arch1-1
  • Python version 3.7.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions