Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to solve ImportError: Keras requires TensorFlow 2.2 or higher. Install TensorFlow via `pip install tensorflow`?

I get this error when I try to import Keras into my project.

How to solve ImportError: Keras requires TensorFlow 2.2 or higher. Install TensorFlow via pip install tensorflow

I verified the versions I have installed (with pip) for everything and I have:

  • Python 3.7.7
  • Tensorflow 2.2.0
  • keras 2.4.3

I have linked a picture of the full error. There is some stuff about Dll but I'm not sure if this is what creates the error.

Error

like image 794
dbJoker Avatar asked Jul 21 '20 02:07

dbJoker


People also ask

How to solve importerror in keras?

How to solve ImportError: Keras requires TensorFlow 2.2 or higher. Install TensorFlow via pip install tensorflow I have linked a picture of the full error.

What version of TensorFlow do I need to install keras?

ImportError: Keras requires TensorFlow 2.2 or higher. Install TensorFlow via `pip install tensorflow` Bookmark this question. Show activity on this post. How I can solve this problem?

How do I restart my computer after installing keras?

Restart your computer after installing it. by simply writing a command on anaconda\command prompt as "conda install keras==2.3.1"


2 Answers

ImportError: Keras requires TensorFlow 2.2 or higher. Install TensorFlow via pip install tensorflow

Fix:

python -m pip install –upgrade pip
pip install keras==2.1.5

This worked for me.

If above step are not solving the error then check your libraries with specific version.

Python==3.6.4
Numpy==1.18.5
Pandas==1.1.4
scikit-learn==0.21.2
Tensorflow==1.13.1
keras==2.1.5 

Hope this worked for you.

like image 113
Moin Uddin Avatar answered Sep 27 '22 19:09

Moin Uddin


Tensorflow requires Python 3.5–3.8 , pip and venv >= 19.0

in order to fix it:

sudo apt install python3-pip

pip3 install --upgrade pip

python3 -m pip install tensorflow

if you already had tensorflow installed substitute the last command this this:

pip3 install --upgrade tensorflow 

hope it helped.

like image 45
BraveAdmin Avatar answered Sep 27 '22 18:09

BraveAdmin