[Question]: `Exception values are incompatible` when cythonizing files
Problem description
I encountered an issue while trying to install and spleeter in Termux.When attempting to install spleeter, it failed to build the numpy wheel due to a Cython compilation error.
What steps will reproduce the bug?
Attempt to install spleeter using pip install spleeter
What is the expected behavior?
No response
System information
termux-info:~ $ pip install spleeter
Collecting spleeter
Using cached spleeter-2.1.0-py3-none-any.whl.metadata (10 kB)
Collecting ffmpeg-python==0.2.0 (from spleeter)
Using cached ffmpeg_python-0.2.0-py3-none-any.whl.metadata (1.7 kB)
Collecting httpx<0.17.0,>=0.16.1 (from httpx[http2]<0.17.0,>=0.16.1->spleeter)
Using cached httpx-0.16.1-py3-none-any.whl.metadata (38 kB)
Collecting librosa==0.8.0 (from spleeter)
Using cached librosa-0.8.0.tar.gz (183 kB)
Preparing metadata (setup.py) ... done
Collecting norbert==0.2.1 (from spleeter)
Using cached norbert-0.2.1-py2.py3-none-any.whl.metadata (3.8 kB)
Collecting numpy<1.19.0,>=1.16.0 (from spleeter)
Using cached numpy-1.18.5.zip (5.4 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... error
error: subprocess-exited-with-error
× Preparing metadata (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [56 lines of output]
Running from numpy source directory.
<string>:461: UserWarning: Unrecognized setuptools command, proceeding with generating Cython sources and expanding templates
/data/data/com.termux/files/usr/tmp/pip-install-uuz4x5my/numpy_2ad58b2f616645afbbfcf9cccb06d96b/tools/cythonize.py:75: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
required_version = LooseVersion('0.29.14')
/data/data/com.termux/files/usr/tmp/pip-install-uuz4x5my/numpy_2ad58b2f616645afbbfcf9cccb06d96b/tools/cythonize.py:77: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
if LooseVersion(cython_version) < required_version:
Error compiling Cython file:
------------------------------------------------------------
...
for i in range(1, RK_STATE_LEN):
self.rng_state.key[i] = val[i]
self.rng_state.pos = i
self._bitgen.state = &self.rng_state
self._bitgen.next_uint64 = &mt19937_uint64
^
------------------------------------------------------------
_mt19937.pyx:138:35: Cannot assign type 'uint64_t (*)(void *) except? -1 nogil' to 'uint64_t (*)(void *) noexcept nogil'. Exception values are incompatible. Suggest adding 'noexcept' to the type of the value being assigned.
Processing numpy/random/_bounded_integers.pxd.in
Processing numpy/random/_mt19937.pyx
Traceback (most recent call last):
File "/data/data/com.termux/files/usr/tmp/pip-install-uuz4x5my/numpy_2ad58b2f616645afbbfcf9cccb06d96b/tools/cythonize.py", line 238, in <module>
main()
File "/data/data/com.termux/files/usr/tmp/pip-install-uuz4x5my/numpy_2ad58b2f616645afbbfcf9cccb06d96b/tools/cythonize.py", line 234, in main
find_process_files(root_dir)
File "/data/data/com.termux/files/usr/tmp/pip-install-uuz4x5my/numpy_2ad58b2f616645afbbfcf9cccb06d96b/tools/cythonize.py", line 225, in find_process_files
process(root_dir, fromfile, tofile, function, hash_db)
File "/data/data/com.termux/files/usr/tmp/pip-install-uuz4x5my/numpy_2ad58b2f616645afbbfcf9cccb06d96b/tools/cythonize.py", line 191, in process
processor_function(fromfile, tofile)
File "/data/data/com.termux/files/usr/tmp/pip-install-uuz4x5my/numpy_2ad58b2f616645afbbfcf9cccb06d96b/tools/cythonize.py", line 80, in process_pyx
subprocess.check_call(
File "/data/data/com.termux/files/usr/lib/python3.11/subprocess.py", line 413, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/data/data/com.termux/files/usr/bin/python3.11', '-m', 'cython', '-3', '--fast-fail', '-o', '_mt19937.c', '_mt19937.pyx']' returned non-zero exit status 1.
Cythonizing sources
Traceback (most recent call last):
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
main()
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 149, in prepare_metadata_for_build_wheel
return hook(metadata_directory, config_settings)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/data/com.termux/files/usr/tmp/pip-build-env-xtv0fkta/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 366, in prepare_metadata_for_build_wheel
self.run_setup()
File "/data/data/com.termux/files/usr/tmp/pip-build-env-xtv0fkta/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 487, in run_setup
super().run_setup(setup_script=setup_script)
File "/data/data/com.termux/files/usr/tmp/pip-build-env-xtv0fkta/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 311, in run_setup
exec(code, locals())
File "<string>", line 488, in <module>
File "<string>", line 469, in setup_package
File "<string>", line 275, in generate_cython
RuntimeError: Running cythonize failed!
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
~ $
Try to install numpy package first with apt install python-numpy command.
You can install numpy with apt (apt install python-numpy) and then install spleeter without build isolation.
Try apt install python-numpy, then pip install spleeter --no-build-isolation.
You can install numpy with apt (
apt install python-numpy) and then install spleeter without build isolation.Try
apt install python-numpy, thenpip install spleeter --no-build-isolation.
I already install before but also have the same bug $ apt install python-numpy Reading package lists... Done Building dependency tree... Done Reading state information... Done python-numpy is already the newest version (1.26.4-1). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. ~ $ pip install spleeter --no-build-isolation Collecting spleeter Using cached spleeter-2.1.0-py3-none-any.whl.metadata (10 kB) Collecting ffmpeg-python==0.2.0 (from spleeter) Using cached ffmpeg_python-0.2.0-py3-none-any.whl.metadata (1.7 kB) Collecting httpx<0.17.0,>=0.16.1 (from httpx[http2]<0.17.0,>=0.16.1->spleeter) Using cached httpx-0.16.1-py3-none-any.whl.metadata (38 kB) Collecting librosa==0.8.0 (from spleeter) Using cached librosa-0.8.0.tar.gz (183 kB) Preparing metadata (setup.py) ... done Collecting norbert==0.2.1 (from spleeter) Using cached norbert-0.2.1-py2.py3-none-any.whl.metadata (3.8 kB) Collecting numpy<1.19.0,>=1.16.0 (from spleeter) Using cached numpy-1.18.5.zip (5.4 MB) Preparing metadata (pyproject.toml) ... error error: subprocess-exited-with-error
× Preparing metadata (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [56 lines of output]
Running from numpy source directory.
Error compiling Cython file:
------------------------------------------------------------
...
for i in range(1, RK_STATE_LEN):
self.rng_state.key[i] = val[i]
self.rng_state.pos = i
self._bitgen.state = &self.rng_state
self._bitgen.next_uint64 = &mt19937_uint64
^
------------------------------------------------------------
_mt19937.pyx:138:35: Cannot assign type 'uint64_t (*)(void *) except? -1 nogil' to 'uint64_t (*)(void *) noexcept nogil'. Exception values are incompatible. Suggest adding 'noexcept' to the type of the value being assigned.
Processing numpy/random/_bounded_integers.pxd.in
Processing numpy/random/_mt19937.pyx
Traceback (most recent call last):
File "/data/data/com.termux/files/usr/tmp/pip-install-tndfmm56/numpy_bf2b5a55380e40e380eb7527b4a92c99/tools/cythonize.py", line 238, in <module>
main()
File "/data/data/com.termux/files/usr/tmp/pip-install-tndfmm56/numpy_bf2b5a55380e40e380eb7527b4a92c99/tools/cythonize.py", line 234, in main
find_process_files(root_dir)
File "/data/data/com.termux/files/usr/tmp/pip-install-tndfmm56/numpy_bf2b5a55380e40e380eb7527b4a92c99/tools/cythonize.py", line 225, in find_process_files
process(root_dir, fromfile, tofile, function, hash_db)
File "/data/data/com.termux/files/usr/tmp/pip-install-tndfmm56/numpy_bf2b5a55380e40e380eb7527b4a92c99/tools/cythonize.py", line 191, in process
processor_function(fromfile, tofile)
File "/data/data/com.termux/files/usr/tmp/pip-install-tndfmm56/numpy_bf2b5a55380e40e380eb7527b4a92c99/tools/cythonize.py", line 80, in process_pyx
subprocess.check_call(
File "/data/data/com.termux/files/usr/lib/python3.11/subprocess.py", line 413, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/data/data/com.termux/files/usr/bin/python3.11', '-m', 'cython', '-3', '--fast-fail', '-o', '_mt19937.c', '_mt19937.pyx']' returned non-zero exit status 1.
Cythonizing sources
Traceback (most recent call last):
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
main()
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 149, in prepare_metadata_for_build_wheel
return hook(metadata_directory, config_settings)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/setuptools/build_meta.py", line 366, in prepare_metadata_for_build_wheel
self.run_setup()
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/setuptools/build_meta.py", line 487, in run_setup
super().run_setup(setup_script=setup_script)
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/setuptools/build_meta.py", line 311, in run_setup
exec(code, locals())
File "<string>", line 488, in <module>
File "<string>", line 469, in setup_package
File "<string>", line 275, in generate_cython
RuntimeError: Running cythonize failed!
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip. error: metadata-generation-failed
× Encountered error while generating package metadata. ╰─> See above for output.
note: This is an issue with the package mentioned above, not pip. hint: See above for details. ~ $
Try use cython<3 to cythonize files.
pip install cython<3
Closing as presumably solved or obsolete.
spleeter
Spleeter depends on Tensorflow.
- https://github.com/termux/termux-packages/issues/24657