Hackermon
Hackermon

Reputation: 306

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

Upvotes: 4

Views: 24762

Answers (5)

Adam De-Nyangos
Adam De-Nyangos

Reputation: 123

I ran into a similar issue. I was following a tutorial that was developed for older versions of Tensorflow and Keras. I was able to import everything I needed from here:

import keras._tf_keras.keras

I'm using Tensorflow version 2.16.1 and Keras version 3.4.0.

Upvotes: 0

nirmal
nirmal

Reputation: 36

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.

Upvotes: 2

matias montagna
matias montagna

Reputation: 31

my solution was downgrade tensorflow to 2.7

!pip uninstall tensorflow !pip install tensorflow==2.7

Upvotes: 3

Carlos Gómez
Carlos Gómez

Reputation: 81

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

Upvotes: 8

Hackermon
Hackermon

Reputation: 306

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

pip uninstall tensorflow
pip install tensorflow

Upvotes: 0

Related Questions