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

numpy 2.0 deprecation warnings #92

Open
MitchellAcoustics opened this issue Nov 3, 2024 · 0 comments
Open

numpy 2.0 deprecation warnings #92

MitchellAcoustics opened this issue Nov 3, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@MitchellAcoustics
Copy link
Owner

MitchellAcoustics commented Nov 3, 2024

Running several of the audio metrics results in numpy 2.0 warnings. We will need to determine which of these are our issues and which are due to the upstream analysis dependencies. Either way, we should implement some sort of warning catch for these. See examples (all produced during b.process_all_metrics()):

03:52:56 | DEBUG    | soundscapy.audio.metrics:pyacoustics_metric_1ch:388Calculating Python Acoustics: SEL None
03:52:56 | WARNING  | soundscapy.logging:showwarning:78__array_wrap__ must accept context and return_scalar arguments (positionally) in the future. (Deprecated NumPy 2.0)
03:52:56 | WARNING  | soundscapy.logging:showwarning:7803:52:56 | WARNING  | soundscapy.logging:showwarning:78__array_wrap__ must accept context and return_scalar arguments (positionally) in the future. (Deprecated NumPy 2.0)

Traceback (most recent call last):
  File "/Users/mitch/Documents/GitHub/Soundscapy/.venv/lib/python3.12/site-packages/loguru/_handler.py", line 200, in emit
    with self._protected_lock():
  File "/Users/mitch/.pyenv/versions/3.12.2/lib/python3.12/contextlib.py", line 137, in __enter__
    return next(self.gen)
           ^^^^^^^^^^^^^^
  File "/Users/mitch/Documents/GitHub/Soundscapy/.venv/lib/python3.12/site-packages/loguru/_handler.py", line 114, in _protected_lock
    raise RuntimeError(
RuntimeError: Could not acquire internal lock because it was already in use (deadlock avoided). This likely happened because the logger was re-used inside a sink, a signal handler or a '__del__' method. This is not permitted because the logger and its handlers are not re-entrant.
--- End of logging error ---
/Users/mitch/Documents/GitHub/Soundscapy/.venv/lib/python3.12/site-packages/loguru/_simple_sinks.py:122: UserWarning: 03:52:56 | WARNING  | soundscapy.logging:showwarning:78__array_wrap__ must accept context and return_scalar arguments (positionally) in the future. (Deprecated NumPy 2.0)

  self._function(message)
/Users/mitch/Documents/GitHub/Soundscapy/.venv/lib/python3.12/site-packages/acoustics/standards/iso_tr_25417_2007.py:110: DeprecationWarning: __array_wrap__ must accept context and return_scalar arguments (positionally) in the future. (Deprecated NumPy 2.0)
  return (pressure**2.0 / fs).sum(axis=axis)

03:52:56 | WARNING  | soundscapy.logging:showwarning:78__array_wrap__ must accept context and return_scalar arguments (positionally) in the future. (Deprecated NumPy 2.0)
/Users/mitch/Documents/GitHub/Soundscapy/.venv/lib/python3.12/site-packages/numpy/_core/_methods.py:52: DeprecationWarning: __array_wrap__ must accept context and return_scalar arguments (positionally) in the future. (Deprecated NumPy 2.0)
  return umr_sum(a, axis, dtype, out, keepdims, initial, where)
/Users/mitch/Documents/GitHub/Soundscapy/.venv/lib/python3.12/site-packages/acoustics/standards/iso_tr_25417_2007.py:125: DeprecationWarning: __array_wrap__ must accept context and return_scalar arguments (positionally) in the future. (Deprecated NumPy 2.0)
  return 10.0 * np.log10(sound_exposure(pressure, fs, axis=axis) / reference_sound_exposure)

03:53:18 | DEBUG    | soundscapy.audio.metrics:maad_metric_2ch:804Calculating scikit-maad all_temporal_alpha_indices
Traceback (most recent call last):
  File "/Users/mitch/Documents/GitHub/Soundscapy/.venv/lib/python3.12/site-packages/loguru/_handler.py", line 200, in emit
    with self._protected_lock():
  File "/Users/mitch/.pyenv/versions/3.12.2/lib/python3.12/contextlib.py", line 137, in __enter__
    return next(self.gen)
           ^^^^^^^^^^^^^^
  File "/Users/mitch/Documents/GitHub/Soundscapy/.venv/lib/python3.12/site-packages/loguru/_handler.py", line 114, in _protected_lock
    raise RuntimeError(
RuntimeError: Could not acquire internal lock because it was already in use (deadlock avoided). This likely happened because the logger was re-used inside a sink, a signal handler or a '__del__' method. This is not permitted because the logger and its handlers are not re-entrant.
--- End of logging error ---
/Users/mitch/Documents/GitHub/Soundscapy/.venv/lib/python3.12/site-packages/loguru/_simple_sinks.py:122: UserWarning: 03:53:18 | WARNING  | soundscapy.logging:showwarning:78__array_wrap__ must accept context and return_scalar arguments (positionally) in the future. (Deprecated NumPy 2.0)

  self._function(message)

Run with:

Name: numpy
Version: 2.0.2
Location: /Users/mitch/Documents/GitHub/Soundscapy/.venv/lib/python3.12/site-packages
Requires:
Required-by: acoustics, bottleneck, contourpy, imageio, matplotlib, mosqito, numba, numexpr, pandas, pyuff, resampy, scikit-image, scikit-maad, scipy, seaborn, tifffile
@MitchellAcoustics MitchellAcoustics added the bug Something isn't working label Nov 3, 2024
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