build error: 'PyThreadState {aka struct _ts}' has no member named 'exc_type'; did you mean 'curexc_type'?
getting the build error shown below my setup is:
OS: Centos7 Dependencies were built using Spack: ^[email protected] ^[email protected] ^[email protected] ^[email protected] ^[email protected] ^[email protected] ^[email protected] ^[email protected] ^[email protected] ^[email protected] ^[email protected] ^[email protected] ^[email protected] ^[email protected] ^[email protected]
==> Installing py-line-profiler
==> Searching for binary cache of py-line-profiler
==> Warning: No Spack mirrors are currently configured
==> No binary for py-line-profiler found: installing from source
==> Using cached archive: /disk/software/lib/hpcpm/spack/var/spack/cache/py-line-profiler/py-line-profiler-2.0.tar.gz
==> Staging archive: /cache/sbulut/spack-stage/py-line-profiler-2.0-5rhvits7zccanvpi6fys7exwzqffo56t/line_profiler-2.0.tar.gz
==> Created stage in /cache/sbulut/spack-stage/py-line-profiler-2.0-5rhvits7zccanvpi6fys7exwzqffo56t
==> No patches needed for py-line-profiler
==> Building py-line-profiler [PythonPackage]
==> Executing phase: 'build'
==> Error: ProcessError: Command exited with status 1:
'/disk/software/lib/hpcpm/spack/opt/spack/linux-centos7-x86_64/gcc-7.4.0/python-3.7.4-djmvnkbqhmcvxtzgmnbxv7z3as7utxdn/bin/python3.7' '-s' 'setup.py' '--no-user-cfg' 'build'
16 errors found in build log:
9 running build_ext
10 skipping '_line_profiler.c' Cython extension (up-to-date)
11 building '_line_profiler' extension
12 creating build/temp.linux-x86_64-3.7
13 /disk/software/lib/hpcpm/spack/lib/spack/env/gcc/gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -fPIC -I/disk/software/lib/hpcpm/spack/opt/spack/linux-centos7-x86_64/gcc-7.
4.0/python-3.7.4-djmvnkbqhmcvxtzgmnbxv7z3as7utxdn/include/python3.7m -c _line_profiler.c -o build/temp.linux-x86_64-3.7/_line_profiler.o
14 _line_profiler.c: In function '__Pyx__ExceptionSave':
>> 15 _line_profiler.c:5478:21: error: 'PyThreadState {aka struct _ts}' has no member named 'exc_type'; did you mean 'curexc_type'?
16 *type = tstate->exc_type;
17 ^~~~~~~~
18 curexc_type
>> 19 _line_profiler.c:5479:22: error: 'PyThreadState {aka struct _ts}' has no member named 'exc_value'; did you mean 'curexc_value'?
20 *value = tstate->exc_value;
21 ^~~~~~~~~
22 curexc_value
>> 23 _line_profiler.c:5480:19: error: 'PyThreadState {aka struct _ts}' has no member named 'exc_traceback'; did you mean 'curexc_traceback'?
24 *tb = tstate->exc_traceback;
25 ^~~~~~~~~~~~~
26 curexc_traceback
27 _line_profiler.c: In function '__Pyx__ExceptionReset':
>> 28 _line_profiler.c:5487:24: error: 'PyThreadState {aka struct _ts}' has no member named 'exc_type'; did you mean 'curexc_type'?
29 tmp_type = tstate->exc_type;
30 ^~~~~~~~
31 curexc_type
>> 32 _line_profiler.c:5488:25: error: 'PyThreadState {aka struct _ts}' has no member named 'exc_value'; did you mean 'curexc_value'?
33 tmp_value = tstate->exc_value;
34 ^~~~~~~~~
35 curexc_value
>> 36 _line_profiler.c:5489:22: error: 'PyThreadState {aka struct _ts}' has no member named 'exc_traceback'; did you mean 'curexc_traceback'?
37 tmp_tb = tstate->exc_traceback;
38 ^~~~~~~~~~~~~
39 curexc_traceback
>> 40 _line_profiler.c:5490:13: error: 'PyThreadState {aka struct _ts}' has no member named 'exc_type'; did you mean 'curexc_type'?
41 tstate->exc_type = type;
42 ^~~~~~~~
43 curexc_type
>> 44 _line_profiler.c:5491:13: error: 'PyThreadState {aka struct _ts}' has no member named 'exc_value'; did you mean 'curexc_value'?
45 tstate->exc_value = value;
46 ^~~~~~~~~
47 curexc_value
>> 48 _line_profiler.c:5492:13: error: 'PyThreadState {aka struct _ts}' has no member named 'exc_traceback'; did you mean 'curexc_traceback'?
49 tstate->exc_traceback = tb;
50 ^~~~~~~~~~~~~
51 curexc_traceback
52 _line_profiler.c: In function '__Pyx__GetException':
>> 53 _line_profiler.c:5547:24: error: 'PyThreadState {aka struct _ts}' has no member named 'exc_type'; did you mean 'curexc_type'?
54 tmp_type = tstate->exc_type;
55 ^~~~~~~~
56 curexc_type
>> 57 _line_profiler.c:5548:25: error: 'PyThreadState {aka struct _ts}' has no member named 'exc_value'; did you mean 'curexc_value'?
58 tmp_value = tstate->exc_value;
59 ^~~~~~~~~
60 curexc_value
>> 61 _line_profiler.c:5549:22: error: 'PyThreadState {aka struct _ts}' has no member named 'exc_traceback'; did you mean 'curexc_traceback'?
62 tmp_tb = tstate->exc_traceback;
63 ^~~~~~~~~~~~~
64 curexc_traceback
>> 65 _line_profiler.c:5550:13: error: 'PyThreadState {aka struct _ts}' has no member named 'exc_type'; did you mean 'curexc_type'?
66 tstate->exc_type = local_type;
67 ^~~~~~~~
68 curexc_type
>> 69 _line_profiler.c:5551:13: error: 'PyThreadState {aka struct _ts}' has no member named 'exc_value'; did you mean 'curexc_value'?
70 tstate->exc_value = local_value;
71 ^~~~~~~~~
72 curexc_value
>> 73 _line_profiler.c:5552:13: error: 'PyThreadState {aka struct _ts}' has no member named 'exc_traceback'; did you mean 'curexc_traceback'?
74 tstate->exc_traceback = local_tb;
75 ^~~~~~~~~~~~~
76 curexc_traceback
>> 77 error: command '/disk/software/lib/hpcpm/spack/lib/spack/env/gcc/gcc' failed with exit status 1
+1 on macOS with homebrew python 3.7
EDIT: Solution for me was to RTFM read the README.md:
#if needed - pip install Cython
git clone https://github.com/rkern/line_profiler.git
find line_profiler -name '*.pyx' -exec cython {} \;
cd line_profiler
pip install . --user
The problem is the generated c files that are included in the package. They are generated by cython from pyx/pxd files. But The c api has changed in 3.7 so they need to be rebuild with an up-to-date version cython.
Can we get a new source releases on pypi with .c code generated by a more modern cython to support python >=3.7?
It doesn't have to be a new version a .post0 would do it
I think Cython should be added to setup_requires and setup script should compile all Cython files while installation. Distribute pre-compiled Cython files and require the C-compiler anyway... seems it is not a good way. If you distribute your package as binary wheel it should be fully pre-built. If you distribute sources it should be only sources without any pre-built files.
Please see how to add Cython to setup_requires:
https://stackoverflow.com/a/38057196/419926