I'm using conda 4.4.9. I have already installed TensorFlow and I want to install Keras as well.
Then I tried to activate my virtual environment and install Keras as below:-
activate tensorflow_env_001
pip install --ignore-installed --upgrade keras
Then I got the following error message:
tensorflow 1.9.0 has requirement setuptools<=39.1.0, but you'll have setuptools 39.2.0 which is incompatible
That means my setuptools
is too new. In fact, I can run the TensorFlow codes without any error. But I just can't install Keras. I tried to update setuptools
but that had just made the situation worse, as setuptools
now become 40.0.0
.
If I run conda list
, and I will see this:-
That means all TensorFlow
, Keras
and setuptools
are here. But when I tried to import Keras
in my Python code, I just got ModuleNotFoundError: No module named 'keras'
.
How can I properly install Keras? Many thanks!!
1) You can try pip install keras==[version number] --user to install a specific version of keras from pypi. this will downgrade the tensorflow and keras version to 1.11. 0 and 2.1. 6-tf respectively.
The recommended approach as of now and in the foreseeable future is to use the keras inside Tensorflow , as even Francois Chollet, the creator of Keras mentions this. Practically, you have to install only TensorFlow, and make all your imports like from tensorflow. keras.
Try to remove the env
conda remove --name ENVNAME --all
Then create a new one but first upgrade the pip version
python -m pip install --upgrade pip
and then install tensorflow:
pip install --ignore-installed --upgrade tensorflow==1.9.0
It will automatically get (downgrade) your version of setuptools
#
# Name Version Build Channel
.......
python 3.5.6 he025d50_0
setuptools 39.1.0 pypi_0 pypi
six 1.12.0 pypi_0 pypi
tensorboard 1.9.0 pypi_0 pypi
tensorflow 1.9.0 pypi_0 pypi
termcolor 1.1.0 pypi_0 pypi
.....
tensorflow 1.9.0 has requirement setuptools<=39.1.0, but you'll have setuptools 39.2.0 which is incompatible
i got same error.To downgrade your setuptools version you can use
pip install setuptools==39.1.0
hope this helps further for keras installations.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With