chris-hld / spaudiopy

Spatial Audio Python Package
https://spaudiopy.readthedocs.io/
MIT License
143 stars 15 forks source link

Current versions of NumPy not supported #35

Closed mmjamm closed 3 days ago

mmjamm commented 1 week ago

Hi! Great library - I use it all the time!

Running Spaudiopy with 2.x versions of NumPy gives errors:

>>> sp.sph.sh_matrix(1, [0], [0])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/build/.local/share/virtualenvs/spaudiopytest-dmcKNxTW/lib/python3.10/site-packages/spaudiopy/sph.py", line 89, in sh_matrix
    Ymn = np.zeros([Q, (N_sph+1)**2], dtype=np.float_)
  File "/home/build/.local/share/virtualenvs/spaudiopytest-dmcKNxTW/lib/python3.10/site-packages/numpy/__init__.py", line 397, in __getattr__
    raise AttributeError(
AttributeError: `np.float_` was removed in the NumPy 2.0 release. Use `np.float64` instead.. Did you mean: 'float16'?

Currently, pip install spaudiopy installs NumPy 2.0.2, which means spaudiopy does not work using the installation instructions in https://spaudiopy.readthedocs.io/en/latest/installation.html

The fix is probably just changing np.float_ to np.float64 in the source code.

pip environment used to reproduce error:

pip list
Package         Version
--------------- -----------
cffi            1.17.1
contourpy       1.3.1
cycler          0.12.1
fonttools       4.55.0
h5py            3.12.1
joblib          1.4.2
kiwisolver      1.4.7
llvmlite        0.43.0
matplotlib      3.9.2
numba           0.60.0
numpy           2.0.2
packaging       24.2
pillow          11.0.0
pip             24.2
pycparser       2.22
pyparsing       3.2.0
python-dateutil 2.9.0.post0
resampy         0.4.3
scipy           1.14.1
setuptools      75.2.0
six             1.16.0
sounddevice     0.5.1
soundfile       0.12.1
spaudiopy       0.1.6
wheel           0.44.0
chris-hld commented 4 days ago

Hi! Thanks for the bug report! This should have been addressed in https://github.com/chris-hld/spaudiopy/commit/3d6cf154754a5342bbc53dbc3b20f8850243cd16 - The fix is not reflected in the pip release, yet. There was a few other fixes, I will release soon. In the meantime, if you need to stick to pip, you can install the latest master with pip install git+https://github.com/chris-hld/spaudiopy.git@master Does that fix your issue?

mmjamm commented 3 days ago

Yes, that fixes it for me. Thanks!