Home > Back-end >  (Google App Engine) ModuleNotFoundError: No module named 'PIL'
(Google App Engine) ModuleNotFoundError: No module named 'PIL'

Time:09-17

I'm trying to develop a website using Flask and deploy it to App Engine. My flask using the PIL module for processing images from Cloud Storage, but when deploying my flask I'm getting an error "No module named PIL". I was already installed PIL with python3 -m pip install Pillow command and update pip with /venv/bin/python -m pip install --upgrade pip

But I check my folder in "/venv/bin/pip" there is an error "No name '_internal' in module 'pip'"

What do you think about this problem?

CodePudding user response:

Suggestion: Try instead of import PIL use import image since it includes PIL and PIL would be installed for you.

As with some installations of PIL you could also do

import image

On some installs the PIL might work But as I have tried with the majority import image does a good job

pip install image // just in case

PS: You could try this too from PIL import Image

CodePudding user response:

Since you're using Python3, you're going to have a requirements.txt file. PIL should be listed in requirements.txt so that it gets installed by Google after you deploy to GAE and try to run your program

  • Related