Why pip install tensorflow-macos==2.15.0 downgrade Keras to 2.15.0

I'm trying to install latest keras 3.0.5, tensorflow-macos and tensorflow-text.

There are conflict in the versions dependencies.

Is there any one able to do that? I'm using "Apple M2" and "Sonoma".

As seen below, tensorflow-macos downgrade keras to 2.15 while tensorflow need keras >= 3

Installing collected packages: wrapt, tensorflow-estimator, pyasn1, oauthlib, ml-dtypes, keras, cachetools, rsa, requests-oauthlib, pyasn1-modules, google-auth, google-auth-oauthlib, tensorboard, tensorflow-macos
  Attempting uninstall: wrapt
    Found existing installation: wrapt 1.16.0
    Uninstalling wrapt-1.16.0:
      Successfully uninstalled wrapt-1.16.0
  Attempting uninstall: ml-dtypes
    Found existing installation: ml-dtypes 0.3.2
    Uninstalling ml-dtypes-0.3.2:
      Successfully uninstalled ml-dtypes-0.3.2
  Attempting uninstall: keras
    Found existing installation: keras 3.0.5
    Uninstalling keras-3.0.5:
      Successfully uninstalled keras-3.0.5
  Attempting uninstall: tensorboard
    Found existing installation: tensorboard 2.16.2
    Uninstalling tensorboard-2.16.2:
      Successfully uninstalled tensorboard-2.16.2
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
tensorflow 2.16.0rc0 requires keras>=3.0.0, but you have keras 2.15.0 which is incompatible.
tensorflow 2.16.0rc0 requires ml-dtypes~=0.3.1, but you have ml-dtypes 0.2.0 which is incompatible.
tensorflow 2.16.0rc0 requires tensorboard<2.17,>=2.16, but you have tensorboard 2.15.2 which is incompatible.

Same problem. I am trying the following:

  • this link https://keras.io/getting_started/ suggests the compatbilities.

TensorFlow compatibility The following Keras + TensorFlow versions are compatible with each other: To use Keras 3:

tensorflow==2.15.0 & keras==3.0.0 tensorflow==2.16.0 & keras==3.0.0

Considering there is not tf-macos 2.16, I am using the first option with pip install.

  • There is this post I tried last week and it was working. I had to delete the venv, which was experimental, and now I can't replicate the result. I tried it because I also have the convergence problem, but I was able to solve it with Keras 3.0.0.

When I try to install Keras 3.0.0, I receive the following error:

"ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. tensorflow-macos 2.15.0 requires keras<2.16,>=2.15.0, but you have keras 3.0.0 which is incompatible."

I also tried to install Keras-nightly and at least it works. This are the result of a base ResNet50 with imagenet weights from tf.

Epoch 1/5 2/2 [==============================] - 14s 4s/step - loss: 6.4140 - accuracy: 0.3750 - val_loss: 9.1743 - val_accuracy: 0.5000 Epoch 2/5 2/2 [==============================] - 2s 355ms/step - loss: 1.2155 - accuracy: 0.7750 - val_loss: 9.4366 - val_accuracy: 0.7000 Epoch 3/5 2/2 [==============================] - 1s 601ms/step - loss: 4.1899 - accuracy: 0.6750 - val_loss: 539.9166 - val_accuracy: 0.6000 Epoch 4/5 2/2 [==============================] - 1s 571ms/step - loss: 0.3937 - accuracy: 0.8500 - val_loss: 1690.7887 - val_accuracy: 0.5000 Epoch 5/5 2/2 [==============================] - 1s 593ms/step - loss: 0.7857 - accuracy: 0.9750 - val_loss: 5639.2158 - val_accuracy: 0.5000

training time acceptable, training accuracy and loss okay. Still, there are problems with validation loss and accuracy, but it is a small step forward.

The pity is that I was able to make it work, but I had problems with Quarto for other reasons.

Actually, I'm trying to execute the following line, which needs Keras 3.0.5 and Tensorflow-text. The problem is while installing tensorflow-text, tf-text downgrades keras to 2.15.0

gemma_lm = keras_nlp.models.GemmaCausalLM.from_preset("gemma_2b_en")

Why there is no tensorflow-macos>2.15.0 that able to support keras >= 3.0.0

pip install tensorflow-macos==2.16
ERROR: Could not find a version that satisfies the requirement tensorflow-macos==2.16 (from versions: 2.12.0, 2.13.0rc0, 2.13.0rc1, 2.13.0rc2, 2.13.0, 2.13.1, 2.14.0rc0, 2.14.0rc1, 2.14.0, 2.14.1, 2.15.0rc0, 2.15.0rc1, 2.15.0)
ERROR: No matching distribution found for tensorflow-macos==2.16
Why pip install tensorflow-macos==2.15.0 downgrade Keras to 2.15.0
 
 
Q