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

sigpy 0.1.25 is incompatible with newer numpy versions #123

Closed
hcmh opened this issue Apr 6, 2023 · 4 comments · Fixed by #126
Closed

sigpy 0.1.25 is incompatible with newer numpy versions #123

hcmh opened this issue Apr 6, 2023 · 4 comments · Fixed by #126
Labels
bug Something isn't working

Comments

@hcmh
Copy link
Contributor

hcmh commented Apr 6, 2023

This is a low-priority issue, as sigpy requires numba, which also does not work with numpy 1.24.

When trying to run the tests on Arch Linux, all tests fail because sigpy uses np.float (and np.complex and np.int), which was deprecated in numpy 1.20 and has been removed in numpy 1.24.0.
np.float32/64 and np.floating are fine, only plain np.float, np.complex and np.int are a problem.

Steps to reproduce the behavior:

  1. Clone/Download sigpy master or 0.1.25
  2. Update numpy to >=1.24
  3. Run ./run_tests.sh
  4. See error:
======================================================================
ERROR: sigpy (unittest.loader._FailedTest)
----------------------------------------------------------------------
ImportError: Failed to import test module: sigpy
Traceback (most recent call last):
  File "/usr/lib/python3.10/unittest/loader.py", line 470, in _find_test_path
    package = self._get_module_from_name(name)
  File "/usr/lib/python3.10/unittest/loader.py", line 377, in _get_module_from_name
    __import__(name)
  File "/home/cholme/uni/git/sigpy/sigpy/__init__.py", line 12, in <module>
    from sigpy import alg, app, config, linop, prox
  File "/home/cholme/uni/git/sigpy/sigpy/alg.py", line 8, in <module>
    from sigpy import backend, util
  File "/home/cholme/uni/git/sigpy/sigpy/util.py", line 236, in <module>
    def dirac(shape, dtype=np.float, device=backend.cpu_device):
  File "/usr/lib/python3.10/site-packages/numpy/__init__.py", line 305, in __getattr__
    raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'float'.
`np.float` was a deprecated alias for the builtin `float`. To avoid this error in existing code, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations. Did you mean: 'cfloat'?

... and 26 more, for all other tests.

Expected behavior would be that the tests fail a bit later because of the incompatibility of numba (any currently released version) and numpy>=1.24

  • OS: Arch Linux
  • Version numpy 1.24.2, sigpy 0.1.25

I have changed all instances of np.float -> float (and np.complex, np.int) at https://github.com/hcmh/sigpy/tree/numpy-float-changes in case you want to apply this now. I have not created a pull request yet, as it is

  1. not really helpful as long as numba does not support the newest numpy release.
  2. I have not checked if this breaks compatibility with any old python/numpy versions that you might want to support.
@hcmh hcmh added the bug Something isn't working label Apr 6, 2023
@hcmh
Copy link
Contributor Author

hcmh commented Apr 11, 2023

I have tried sigpy with a pre-release version of numba, and can confirm that it works with the fixes I posted above.

@frankong
Copy link
Member

cool, thanks! let's wait til the numba version is released then

@sidward
Copy link
Collaborator

sidward commented May 7, 2023

@hcmh Looks like it's out! When you're able, can you please create a PR with the fixes?

@hcmh
Copy link
Contributor Author

hcmh commented May 9, 2023

@sidward Just opened it as #126
I have replaced them with their equivalent python identifiers, not with float64 or complex128 or something like that.

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

Successfully merging a pull request may close this issue.

3 participants