First notebook error 'module 'keras.preprocessing.image' has no attribute 'load_img''

Hello community!

I wanted to open this topic because I’ve been having the same issue as in older notebooks in the first course.

In the C2W1 notebook 1 we have to upload our photos, so the model can classify them between cats or dogs, my notebook is not able to ‘load’ the images. The specific error that I receive is the following: "module ‘keras.preprocessing.image’ has no attribute ‘load_img’ "

I tried to run the colab file in different machines, but no different outcome.

[code removed - moderator]

I attached the screenshot of the error and the colab file.
Hope you can help me!


Hi Carlos,
It seems to be a problem of the imported package.
Can you try changing the code from keras.preprocessing import image to from tensorflow.keras.preprocessing import image and see if it works?


Recent versions of tensorflow deprecate the preprocessing package. Please change references to tf.keras.preprocessing.image with tf.keras.utils

The staff have been notified to fix the notebook. Thank you.