Skip to content Skip to sidebar Skip to footer

StopIteration: Could Not Import PIL.Image. The Use Of `array_to_img` Requires PIL Error

import keras Using TensorFlow backend. from keras.preprocessing.image import ImageDataGenerator train_datagen = ImageDataGenerator( rescale=1./255, shear_range=0.2, zoo

Solution 1:

I came the same error as you. this is my environment: I create "tensorflow" env in anaconda, python 3.6 kernel,activate the env, then

pip install tensorflow

pip install keras

pip install pillow

and the error was fixed.


Solution 2:

I had the same problem. If you are using Anaconda and the Jupyter notebook this is what worked for me.

Close your notebook and stop Jupyter. Exit out of your environment Restart the environment again and run:

pip install pillow

and then:

pip install jupyterlab

and start jupyter-notebook back up and then add or (re-run):

from PIL import Image

In your notebook and hopefully .fit_generator will no longer throw that error.


Post a Comment for "StopIteration: Could Not Import PIL.Image. The Use Of `array_to_img` Requires PIL Error"