C2_W4_Lab_1_multi_class_classifier Error

In the ungraded lab for C2_W4, I am encountering a ModuleNotFound when I run the the code that prepares the ImageDataGenerator. Specifically, this first line of the code:

from keras_preprocessing.image import ImageDataGenerator

throws the error:

ModuleNotFoundError Traceback (most recent call last)
in <cell line: 1>()
----> 1 from keras_preprocessing.image import ImageDataGenerator
2
3 TRAINING_DIR = “tmp/rps-train/rps”
4 training_datagen = ImageDataGenerator(
5 rescale = 1./255,

ModuleNotFoundError: No module named ‘keras_preprocessing’

*Since this is an ungraded lab, we are not supposed to have to make edits to this code. Given that tensorflow was imported in a previously run code cell, does anyone have any thoughts why I am getting this error?

Best Regards-*

I’m not a mentor for this course, but here are some basics to check:

  • Did you run all the cells as soon as you opened the notebook? You must do this every time you open a notebook.

  • Are you running the lab via Coursera Labs in your browser, or are you running the notebook on some other platform?

(1) Yes, ran all the previous cells.
(2) Yes, running in CoLab

Note that CoLab is a Google project, not Coursera Labs.

I’m not sure which platform this course uses.

Sorry, that’s the limit of my knowledge regarding this specific course.

Ok, after a bit of searching on StackOverflow, I figured it out. I replaced that line of code with:

from tensorflow.keras.preprocessing.image import ImageDataGenerator

Thanks for trying to help.

Hello @James_Watkins ,

As per the error, it seems you have tried to use a module that is not supposed to be installed as it is not pre-coded.
You need to code between this block only:

### START CODE HERE 
.... 
### END CODE HERE

Try removing any extra module you tried to use or import in your code.

If this doesn’t help, send me your notebook via dm such that I can check where it went wrong. By clicking on the profile picture, you will see an option to message. There you can attach your notebook. Then we can discuss the issues here, under the topic you created.

With regards,
Nilosree Sengupta

Thank you Nilosree, I managed to figure it out.

Hello @James_Watkins ,

That’s great!!
Happy learning !!

With regards,
Nilosree Sengupta