I was following the steps of the tutorial in a local environment with Python 3.10.14 after installing with pip install -e., and a NumPy error occurs that prevents the code from running. Here are some examples:
AttributeError: module 'numpy' has no attribute 'int'.
np.int was a deprecated alias for the builtin int. To avoid this error in existing code, use int by itself. Doing this will not modify any behavior and is safe. When replacing np.int, you may wish to use e.g. np.int64 or np.int32 to specify the precision. If you wish to review your current use, check the release note link for additional information.
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
AttributeError: module 'numpy' has no attribute 'bool'.
np.bool was a deprecated alias for the builtin bool. To avoid this error in existing code, use bool by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use np.bool_ 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
These errors seem to be caused by an incompatibility between the project code and the installed version of NumPy. The aliases np.int and np.bool were deprecated in NumPy 1.20 and removed in later versions.
Proposed solution:
Update the project code to use int instead of np.int, bool or np.bool_ instead of np.bool, and the same for other cases. Alternatively, specify a compatible version of NumPy in the project's requirements.
I was following the steps of the tutorial in a local environment with Python 3.10.14 after installing with
pip install -e
., and a NumPy error occurs that prevents the code from running. Here are some examples:AttributeError: module 'numpy' has no attribute 'int'.
np.int
was a deprecated alias for the builtinint
. To avoid this error in existing code, useint
by itself. Doing this will not modify any behavior and is safe. When replacingnp.int
, you may wish to use e.g.np.int64
ornp.int32
to specify the precision. If you wish to review your current use, check the release note link for additional information. 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#deprecationsAttributeError: module 'numpy' has no attribute 'bool'.
np.bool
was a deprecated alias for the builtinbool
. To avoid this error in existing code, usebool
by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, usenp.bool_
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#deprecationsThese errors seem to be caused by an incompatibility between the project code and the installed version of NumPy. The aliases np.int and np.bool were deprecated in NumPy 1.20 and removed in later versions.
Proposed solution: Update the project code to use int instead of np.int, bool or np.bool_ instead of np.bool, and the same for other cases. Alternatively, specify a compatible version of NumPy in the project's requirements.
Environment: Python 3.10.14 NumPy version: 1.25.2