ModuleNotFoundError: No module named 'tensorflow.python.keras.applications'

Viewed 8821

I am trying to import

import tensorflow.python.keras.applications

but it gives the bellow error:

ModuleNotFoundError: No module named 'tensorflow.python.keras.applications'

my TensorFlow version is 2.8.0 and Keras version is 2.8.0

4 Answers

my solution was downgrade tensorflow to 2.7

!pip uninstall tensorflow !pip install tensorflow==2.7

Try using import keras.applications instead of import tensorflow.python.keras.applications

No need to downgrade or uninstall tensorflow. The resolution of this error resides in resnet_v1.py file i changed the foll line:

  • from tensorflow.python.keras.applications import resnet

to

  • from tensorflow.keras.applications import resnet

and it got resolved because tensorflow.python is deprecated long time ago.

I was able to fix the problem by uninstalling TensorFlow and installing it back.

pip uninstall tensorflow
pip install tensorflow
Related