StopIteration: Could not import PIL.Image. The use of `array_to_img` requires PIL

Viewed 5141

I get this error while running a keras code, so keras is trying to import

from PIL import Image as pil_image

I have installed pillow, also I'm able to successfully import this in my python terminal but in jupyter notebook it gives import error.

env - ubuntu 16 on aws ec2 instance, I'm using aws deep learning ami for ubuntu

pillow comes with conda, I also tried to install using pip

but again I can import it in python/ipython shell but not in jupyter notebook.

2 Answers

I had opencv installed. But I just installed pillow(keeping opencv) and it worked for me.

So, It seems pillow/pil was included in jesper or opencv package on jupyter notebook, so I uninstalled both jesper and opencv in package portal of notebook and installed pillow. now everything is running fine.

Related