Error with numpy >= 1.24 (numpy.float removed)
I ran into this problem today while trying to import openpyxl:
Python 3.11.5 (main, Aug 28 2023, 00:00:00) [GCC 13.2.1 20230728 (Red Hat 13.2.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import openpyxl
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/emil/.local/lib/python3.11/site-packages/openpyxl/__init__.py", line 4, in <module>
from openpyxl.compat.numbers import NUMPY, PANDAS
File "/home/emil/.local/lib/python3.11/site-packages/openpyxl/compat/__init__.py", line 3, in <module>
from .numbers import NUMERIC_TYPES
File "/home/emil/.local/lib/python3.11/site-packages/openpyxl/compat/numbers.py", line 41, in <module>
numpy.float,
^^^^^^^^^^^
File "/home/emil/.local/lib/python3.11/site-packages/numpy/__init__.py", line 324, 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'?
It seems the aliases used in compat/numbers.py have been removed from numpy.