scipy: BUG: cythonization / compliation failure with development branch of cython
Describe your issue.
cython commit https://github.com/cython/cython/commit/77918c57b5f36bee708f625e2499bf05b23a87f1 in https://github.com/cython/cython/pull/4670 broke scipy installation. This is currently only on cython’s master branch and not in an alpha release yet.
I’m not sure if this is best fixed on the scipy or cython side.
I reported this via back-channels to @rgommers.
Reproducing Code Example
pip install -v --no-build-isolation .
with the development version of cython installed.
### Error message
```shell
The relevant error from compilation is :
Error compiling Cython file:
------------------------------------------------------------
...
if name == NULL:
name_copy = name
else:
name_copy = strdup(name)
capsule = PyCapsule_New(func, name_copy, &raw_capsule_destructor)
^
------------------------------------------------------------
/home/tcaswell/source/p/scipy/scipy/scipy/_lib/_ccallback_c.pyx:80:45: Cannot assign type 'void (*)(object) except *' to 'PyCapsule_Destructor'
Traceback (most recent call last):
File "/home/tcaswell/source/p/scipy/scipy/scipy/_build_utils/cythoner.py", line 28, in <module>
main()
File "/home/tcaswell/source/p/scipy/scipy/scipy/_build_utils/cythoner.py", line 20, in main
sbp.run(['cython', '-3', '--fast-fail',
File "/home/tcaswell/.pybuild/bleeding/lib/python3.12/subprocess.py", line 571, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['cython', '-3', '--fast-fail', '--output-file', '/home/tcaswell/source/p/scipy/scipy/.mesonpy-jnf3i747/build/scipy/_lib/_ccallback_c.cpython-312-x86_64-linux-gnu.so.p/_ccallback_c.c', '--include-dir', '/home/tcaswell/source/p/scipy/scipy/.mesonpy-jnf3i747/build', '/home/tcaswell/source/p/scipy/scipy/scipy/_lib/_ccallback_c.pyx']' returned non-zero exit status 1.
### SciPy/NumPy/Python version information
numpy main, cpython main, scipy main
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 32 (29 by maintainers)
Commits related to this issue
- BLD: fix an issue with Cython 3.0 not liking `scipy/*.pxd` files This chips away at the issues listed in gh-17234 for Cython 3.0b1 — committed to rgommers/scipy by rgommers a year ago
- CI: fix pre-release job that is failing on Cython 3.0b1 xref gh-17234 for the remaining issues — committed to rgommers/scipy by rgommers a year ago
- CI: fix pre-release job that is failing on Cython 3.0b1 xref gh-17234 for the remaining issues — committed to rgommers/scipy by rgommers a year ago
- BLD: fix an issue with Cython 3.0 not liking `scipy/*.pxd` files This chips away at the issues listed in gh-17234 for Cython 3.0b1 — committed to rgommers/scipy by rgommers a year ago
- BLD: fix an issue with Cython 3.0 not liking `scipy/*.pxd` files This chips away at the issues listed in gh-17234 for Cython 3.0b1 — committed to rgommers/scipy by rgommers a year ago
- CI: fix pre-release job that is failing on Cython 3.0b1 xref gh-17234 for the remaining issues [skip actions] [skip cirrus] [skip circle] — committed to rgommers/scipy by rgommers a year ago
- BLD: fix an issue with Cython 3.0 not liking `scipy/*.pxd` files This chips away at the issues listed in gh-17234 for Cython 3.0b1 — committed to rgommers/scipy by rgommers a year ago
- Add an explicit (although unnecessary) "noexcept" marker to the "PyCapsule_Destructor" function type to document explicitly that it must not emit exceptions. See https://github.com/scipy/scipy/issues... — committed to cython/cython by scoder a year ago
- Add an explicit (although unnecessary) "noexcept" marker to the "PyCapsule_Destructor" function type to document explicitly that it must not emit exceptions. See https://github.com/scipy/scipy/issues... — committed to cython/cython by scoder a year ago
- [PKG-1332] Updates SciPy to v1.10.1 - Updates SciPy to v1.10.1 - This fixes a reported bug for a customer - Removes `setup.py` dependency as per the linter's suggestion - Doing so caused a handful ... — committed to AnacondaRecipes/scipy-feedstock by schuylermartin45 a year ago
- [PKG-1332] Updates SciPy to v1.10.1 - Updates SciPy to v1.10.1 - This fixes a reported bug for a customer Eric, Ari, and I attempted to move away from using `setup.py` but as Marco stated in the las... — committed to AnacondaRecipes/scipy-feedstock by schuylermartin45 a year ago
- [PKG-1332] Updates SciPy to v1.10.1 - Updates SciPy to v1.10.1 - This fixes a reported bug for a customer - Adds linter skipping for known issues (see below) Eric, Ari, and I attempted to move away ... — committed to AnacondaRecipes/scipy-feedstock by schuylermartin45 a year ago
- Fix Cython compile for v3.0.0 release Cython `v3.0.0` was recently released (https://github.com/cython/cython/releases/tag/3.0.0) and is used in newly built docker images. This causes a compilation i... — committed to lhutton1/tvm by lhutton1 a year ago
- Fix Cython compile for v3.0.0 release Cython `v3.0.0` was recently released (https://github.com/cython/cython/releases/tag/3.0.0) and is used in newly built docker images. This causes a compilation i... — committed to lhutton1/tvm by lhutton1 a year ago
- Fix Cython compile for v3.0.0 release Cython `v3.0.0` was recently released (https://github.com/cython/cython/releases/tag/3.0.0) and is used in newly built docker images. This causes a compilation i... — committed to lhutton1/tvm by lhutton1 a year ago
That very much looks like a 3.0 change (just look at the length of the discussion 😃 ). I can’t say right now if there is something simpler that we could do for 0.29.x. The last (two?) times that we introduced larger changes to 0.29.x always ended with a rollback because we broke someone’s code in unexpected ways. I’d like to avoid doing that again.
However, we certainly do not want to introduce changes in 3.0 that are difficult for users to adapt to, so let’s see what we can come up with.
I have created PoC pull request showing compilable version of scipy using cython3 - #18242
Just a note: Cython 3 has
legacy_implicit_noexcept
compiler directive which forces exception handling to be backward compatible with 0.29.X Cython. This directive was introduced to help Cython users with migration to Cython 3.