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

BUG: Crash on import #4

Closed
jan-david-fischbach opened this issue Oct 14, 2024 · 3 comments
Closed

BUG: Crash on import #4

jan-david-fischbach opened this issue Oct 14, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@jan-david-fischbach
Copy link
Contributor

This change in scipy leads to a crash at import time, when running a version of treams compiled with an incompatible version of scipy (before 1.14.1).

@jan-david-fischbach jan-david-fischbach self-assigned this Oct 14, 2024
@jan-david-fischbach jan-david-fischbach added the bug Something isn't working label Oct 14, 2024
@jan-david-fischbach
Copy link
Contributor Author

TypeError: C function scipy.special.cython_special.__pyx_fuse_0spherical_jn has wrong signature (expected __pyx_t_double_complex (long, __pyx_t_double_complex, int __pyx_skip_dispatch, struct __pyx_fuse_0__pyx_opt_args_5scipy_7special_14cython_special_spherical_jn *__pyx_optional_args), got __pyx_t_double_complex (Py_ssize_t, __pyx_t_double_complex, int __pyx_skip_dispatch, struct __pyx_fuse_0__pyx_opt_args_5scipy_7special_14cython_special_spherical_jn *__pyx_optional_args))

@jan-david-fischbach
Copy link
Contributor Author

jan-david-fischbach commented Oct 15, 2024

To summarize:

  • scipy introduces a breaking change in v1.14.1 where the input parameters for many scipy.cython_special functions was changed from long to Py_ssize_t
  • this makes the treams binaries compiled with a previous version of scipy incompatible to modern scipy and vice versa.
  • these newest versions of scipy do only support python>=3.10
  • As a consequence the only way forward, that I can see, is to drop support for python<=3.9 and require scipy>=1.14.1, against which we then compile. This breaks a lot of compatibility with older versions of these dependencies, but I do not see another way (as far as I can see we cannot adaptively install a different binary depending on the version of scipy).
  • If a user wants to use treams with older versions of python/scipy they will have to resort to older versions of treams :/

@jan-david-fischbach
Copy link
Contributor Author

jan-david-fischbach commented Oct 23, 2024

Revised Summary

After the release of scipy v1.14.1 has lead to a binary incompatibility to the precompiled treams, I have now established the following solution (in #5):

  1. For python<=3.9 we continue to compile treams as before, as scipy>=1.14.1 does not support these versions of python anyways.
  2. For python>=3.10 we now compile against scipy>=1.14.1 and also require scipy>=1.14.1 for installation.

With this strategy we should cover all cases in which treams is newly installed.

Problems:

If a user has previously installed treams and now updates scipy [^1] it will result in the following error at import time:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/jd/bin/mambaforge/envs/treams-dev/lib/python3.10/site-packages/treams/__init__.py", line 63, in <module>
    from treams._core import (  # noqa: F401
  File "/home/jd/bin/mambaforge/envs/treams-dev/lib/python3.10/site-packages/treams/_core.py", line 8, in <module>
    import treams._operators as op
  File "/home/jd/bin/mambaforge/envs/treams-dev/lib/python3.10/site-packages/treams/_operators.py", line 8, in <module>
    import treams.special as sc
  File "/home/jd/bin/mambaforge/envs/treams-dev/lib/python3.10/site-packages/treams/special/__init__.py", line 204, in <module>
    from treams.special import _gufuncs, _ufuncs  # noqa: F401
  File "src/treams/special/_gufuncs.pyx", line 1, in init treams.special._gufuncs
    """Generalized universal functions for the special subpackage"""
  File "src/treams/special/_waves.pyx", line 1, in init treams.special._waves
    """Special mathematical functions related to waves"""
TypeError: C function scipy.special.cython_special.__pyx_fuse_0spherical_jn has wrong signature (expected __pyx_t_double_complex (long, __pyx_t_double_complex, int __pyx_skip_dispatch, struct __pyx_fuse_0__pyx_opt_args_5scipy_7special_14cython_special_spherical_jn *__pyx_optional_args), got __pyx_t_double_complex (Py_ssize_t, __pyx_t_double_complex, int __pyx_skip_dispatch, struct __pyx_fuse_0__pyx_opt_args_5scipy_7special_14cython_special_spherical_jn *__pyx_optional_args))

unfortunately I do not see any way around this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant