Skip to content Skip to sidebar Skip to footer

Attributeerror: Keras.backend ,no Attribute 'eager'

I'm using python 3.8.2 , keras 2.3.1 and tensorflow 2.2.0rc4 . just with the following code : import keras from keras.models import sequential I have this error : AttributeError

Solution 1:

My suggestion is to reinstall the package. Sometimes this happens due to the installation problem.

Use the following code to do so

Uninstall tensorflow

pip uninstall tensorflow

Requires the latest pip

pip install --upgrade pip

To install keras as separate package

pip install Keras

Current stable release for CPU and GPU

pip install tensorflow

Try this and hope this helps you.

Solution 2:

It's an install problem, most likely; K.eager was introduced in Keras 2.3.0 (and is included in Keras 2.3.1), so your Python interpreter is somehow reading code of 2.2.5 or earlier.

A possible culprit is an Anaconda mishap. First run conda uninstall keras. Then, in the anaconda3 directory, search "keras" and delete all results. Lastly, run conda install -c conda-forge keras, which should download version 2.3.1. You might need to run similar steps with TensorFlow (in fact, it's better you do, and first reinstall TensorFlow then Keras).

P.S., your code is probably from keras import Sequential, as sequential should error differently.

Post a Comment for "Attributeerror: Keras.backend ,no Attribute 'eager'"