0

I am trying to make an image gallery page with flask, I need to use pillow to resize the images to show them as thumbnails but when I try to import pillow I get an error.

I am using python3.5 and I didn't install pillow on top of the PILL I am using a ubuntu server that runs apache2. All packages are installed in a virtualenv. I tried to reinstall pillow, also tried different versions of it still does not working. It works when I try it seperately but not working with flask project. Also pip freeze shows that I have Pillow==6.1.0

I used this to install pillow:

pip install Pillow

This line gives error:

from PIL import Image

This is the error log:

Traceback (most recent call last):
File "/var/www/flaskapp/flaskapp.wsgi", line 7, in <module>
from flaskapp import app as application
File "/var/www/flaskapp/flaskapp/__init__.py", line 3, in <module>
from PIL import Image
File "/var/www/flaskapp/flaskapp/venv/lib/python3.5/site-packages/PIL/Image.py", line 95, in <module>
from . import _imaging as core

ImportError: cannot import name _imaging
can
  • 309
  • 1
  • 4
  • 13
  • Related question here: https://stackoverflow.com/questions/25340698/importerror-cannot-import-name-imaging – Frank Jul 22 '19 at 04:13
  • Possible duplicate of [ImportError: cannot import name \_imaging](https://stackoverflow.com/questions/25340698/importerror-cannot-import-name-imaging) – monotasker Jul 22 '19 at 04:13
  • I am using python3.5 and I didn't install pillow on top of the PILL – can Jul 22 '19 at 04:22

1 Answers1

0

Pillow should be uninstalled first, make sure that you delete all the cache files related to pillow in the original path( /usr/local/lib/python3.5/dist-packages/) where the packages of your python version are stored. Once this is done try re installing the pillow from the beginning.