Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keras Applications and Preprocessing Versions for TensorFlow

I'm getting the following message when I install the *.whl for TensorFlow. I'm installing from source just like this: https://www.tensorflow.org/install/install_sources

keras 2.2.2 has requirement keras-applications==1.0.4, but you'll have keras-applications 1.0.5 which is incompatible.
keras 2.2.2 has requirement keras-preprocessing==1.0.2, but you'll have keras-preprocessing 1.0.3 which is incompatible.
Installing collected packages: keras-applications, keras-preprocessing, tensorflow
  Found existing installation: Keras-Applications 1.0.4
    Uninstalling Keras-Applications-1.0.4:
      Successfully uninstalled Keras-Applications-1.0.4
  Found existing installation: Keras-Preprocessing 1.0.2
    Uninstalling Keras-Preprocessing-1.0.2:
      Successfully uninstalled Keras-Preprocessing-1.0.2
Successfully installed keras-applications-1.0.5 keras-preprocessing-1.0.3 tensorflow-1.10.0

Do you know why the installation removes the correct versions of Keras-Applications and Keras-Preprocessing, and reinstalls with the newer incompatible versions?

Thanks

like image 600
Abakada Avatar asked Aug 29 '18 11:08

Abakada


People also ask

Which version of TensorFlow is compatible with Keras?

Installation & compatibility To start using Keras, simply install TensorFlow 2. Keras/TensorFlow are compatible with: Python 3.7–3.10.

Is TensorFlow 2.0 same as Keras?

TensorFlow is an open-sourced end-to-end platform, a library for multiple machine learning tasks, while Keras is a high-level neural network library that runs on top of TensorFlow. Both provide high-level APIs used for easily building and training models, but Keras is more user-friendly because it's built-in Python.

What is the latest version of Keras?

keras 2.10. 0 Deep learning for humans.

Which Python version is best for Keras?

Tensorflow and Keras require a python version of at least 3.7. Use the following command to install Python 3.8. After installing Python 3.8, assign this version as the standard version.


1 Answers

It seems that you'll need Keras-2.1.6 instead of Keras-2.2.2. So, use

sudo -H pip uninstall Keras

to uninstall the current 2.2.2 version, then

sudo pip install Keras==2.1.6

Hopefully this can fix the issue you have.

Regarding the reason why this happens, I think it is because TensorFlow requires Keras-Applications>=1.0.5, and Keras-Preprocessing>=1.0.3. The package management algorithm always go with the latest available package, which bring to us Kera-2.2.2. Whereas latest Keras have an odd dependency requirement, which specifically requires Keras-Applications==1.0.4, and Keras-Preprocessing==1.0.2. My fix is to roll back Keras to a slight older version that have >= requirements, to make pip happy.

One step further, I think it is either a bug in Keras 2.2.2's dependency, or it is intensional because Keras 2.2.2 is somehow incompatible with latest Keras-Applications or Keras-Preprocessing.

like image 104
jer_yin Avatar answered Oct 16 '22 06:10

jer_yin