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

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



Solution 1:[1]

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

Solution 2:[2]

my solution was downgrade tensorflow to 2.7

!pip uninstall tensorflow !pip install tensorflow==2.7

Solution 3:[3]

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.

Solution 4:[4]

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

pip uninstall tensorflow
pip install tensorflow

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Carlos Gómez
Solution 2 matias montagna
Solution 3 nirmal
Solution 4 Hackermon