currently packaged version is incompatible with NumPy 2
Description:
The currently packaged version of Keras is incompatible with NumPy 2.*:
Traceback (most recent call last):
File "/home/user/src/ml-keras-test/./ml-test.py", line 58, in <module>
keras.callbacks.ModelCheckpoint(filepath="model_at_epoch_{epoch}.keras"),
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.13/site-packages/keras/src/callbacks/model_checkpoint.py", line 173, in __init__
self.best = np.Inf
^^^^^^
File "/usr/lib/python3.13/site-packages/numpy/__init__.py", line 400, in __getattr__
raise AttributeError(
...<3 lines>...
)
AttributeError: `np.Inf` was removed in the NumPy 2.0 release. Use `np.inf` instead.
Additional info:
Name : python-keras
Version : 3.4.1-2
Name : python-numpy
Version : 2.2.4-1
Compatibility with NumPy 2.0 was added in Keras version 3.5.0: https://github.com/keras-team/keras/releases/tag/v3.5.0
Steps to reproduce:
pacman -S python-keras python-pytorch- get code for basic Keras tutorial: https://github.com/keras-team/keras-io/blob/master/guides/intro_to_keras_for_engineers.py
- change line 36 to
os.environ["KERAS_BACKEND"] = "torch" - run script