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

Update librosa for compatibility with numpy 1.24 #2442

Closed
mweinelt opened this issue Mar 21, 2023 · 5 comments
Closed

Update librosa for compatibility with numpy 1.24 #2442

mweinelt opened this issue Mar 21, 2023 · 5 comments
Labels
wontfix This will not be worked on but feel free to help.

Comments

@mweinelt
Copy link
Contributor

Numpy is now indeed relaxed, but the librosa version pinned is incompatible with latest numpy(==1.24.2) version. In fact tts was previously already working against numpy 1.23.5, and that is still the latest version that works for me after this release.

Importing librosa on an environment with numpy 1.24 leads to the following traceback for me. This can happen because librosa only sets a lower bound for its numpy version.

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "<string>", line 1, in <lambda>
  File "/nix/store/0n4y44dnaxafqs7cg625aldrb152x7bx-python3-3.10.10/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/nix/store/hqwqi97ayil2bijhxdlnpy4a1ch1cj3h-python3.10-librosa-0.8.1/lib/python3.10/site-packages/librosa/__init__.py", line 211, in <module>
    from . import core
  File "/nix/store/hqwqi97ayil2bijhxdlnpy4a1ch1cj3h-python3.10-librosa-0.8.1/lib/python3.10/site-packages/librosa/core/__init__.py", line 9, in <module>
    from .constantq import *  # pylint: disable=wildcard-import
  File "/nix/store/hqwqi97ayil2bijhxdlnpy4a1ch1cj3h-python3.10-librosa-0.8.1/lib/python3.10/site-packages/librosa/core/constantq.py", line 1059, in <module>
    dtype=np.complex,
  File "/nix/store/0xhlg0vi0y8m5lxsm8khcqqma8rmy2jr-python3.10-numpy-1.24.2/lib/python3.10/site-packages/numpy/__init__.py", line 305, in __getattr__
    raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'complex'.
`np.complex` was a deprecated alias for the builtin `complex`. To avoid this error in existing code, use `complex` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.complex128` 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: 'complex_'?

https://github.com/librosa/librosa/blame/0.8.0/librosa/core/constantq.py#L1058

The np.complex attribute was dropped in numpy 1.24.0.

The deprecation for the aliases np.object, np.bool, np.float, np.complex, np.str, and np.int is expired (introduces NumPy 1.20). Some of these will now give a FutureWarning in addition to raising an error since they will be mapped to the NumPy scalars in the future.

https://numpy.org/devdocs/release/1.24.0-notes.html

Originally posted in #2315 (comment), but reposting here to make it actionable.

@erogol
Copy link
Member

erogol commented Mar 23, 2023

Weird but then the CI would fail. Is there something I am missing?

@mweinelt mweinelt changed the title numpy version still constrained by librosa version Update librosa for compatibility with numpy 1.24 Mar 23, 2023
@mweinelt
Copy link
Contributor Author

Numba still constrains the numpy version to below 1.24.0, see https://github.com/numba/numba/blob/288a38bbd5a15418a211bf067878dfdf3c139509/setup.py#L26, that's why this hasn't become an issue on the CI.

We (nixpkgs) backported numpy 1.24 support for numba, that's why we're running into this error. I'm currently overriding the dependencies for TTS

So my ask is probably about updating librosa to a newer release with numpy 1.24 support. The change required seems to be available from 0.9: librosa/librosa@a9598f9

@erogol
Copy link
Member

erogol commented Apr 5, 2023

This might help #2480 ?

@mweinelt
Copy link
Contributor Author

mweinelt commented Apr 5, 2023

Thanks, it will!

@stale
Copy link

stale bot commented May 8, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You might also look our discussion channels.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on but feel free to help.
Projects
None yet
Development

No branches or pull requests

2 participants