2

When I run python manage.py runserver, everything starts out fine, but then I get a SystemCheckError stating that Pillow is not installed; however, Pillow is definitely installed on this machine.

This is the error I receive:

Performing system checks...

Unhandled exception in thread started by Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/django/utils/autoreload.py", line 225, in wrapper fn(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/runserver.py", line 110, in inner_run self.validate(display_num_errors=True) File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 468, in validate return self.check(app_configs=app_configs, display_num_errors=display_num_errors) File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 527, in check raise SystemCheckError(msg) django.core.management.base.SystemCheckError: SystemCheckError: System check identified some issues:

ERRORS: recipes.Recipes.primary_image: (fields.E210) Cannot use ImageField because Pillow is not installed. HINT: Get Pillow at https://pypi.python.org/pypi/Pillow or run command "pip install Pillow". recipes.Recipes.thumbnail_image: (fields.E210) Cannot use ImageField because Pillow is not installed. HINT: Get Pillow at https://pypi.python.org/pypi/Pillow or run command "pip install Pillow".

I'm running this on an Ubuntu machine. Any ideas what's up?

GileBrt
  • 1,830
  • 3
  • 20
  • 28
acs254
  • 513
  • 2
  • 10
  • 25

2 Answers2

0

In your code, if you have anywhere tried to use the import statements like import pillow or from pillow import ..., change those statements to:

from PIL import ...

or

import PIL

PIL i.e Python Imaging Library is no longer maintained, Pillow is used instead. To maintain backwards compatibility, PIL module name is used in imports.

Rahul Gupta
  • 46,769
  • 10
  • 112
  • 126
  • I do not have 'import pillow' or 'from pillow import...' anywhere in my code. – acs254 Sep 10 '15 at 04:03
  • Check if `PIL` is also installed along with `pillow`. If it is, then uninstall `PIL`. – Rahul Gupta Sep 10 '15 at 04:55
  • PIL is not installed. – acs254 Sep 10 '15 at 04:59
  • Go to Django shell and try the command `from PIL import Image`. Check if that works correctly – Rahul Gupta Sep 10 '15 at 05:01
  • When I try the command you suggest, the following error occurs: >>> from PIL import Image Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python2.7/dist-packages/PIL/Image.py", line 63, in from PIL import _imaging as core ImportError: libopenjp2.so.7: cannot open shared object file: No such file or directory – acs254 Sep 10 '15 at 05:17
  • This might be due to `LD_LIBRARY_PATH`. check these links. 1. https://community.webfaction.com/questions/18564/pillow-unable-to-find-libopenjp2so7-despite-being-in-ld_library_path 2. http://stackoverflow.com/questions/5545580/pil-libjpeg-so-8-cannot-open-shared-object-file-no-such-file-or-directory – Rahul Gupta Sep 10 '15 at 05:58
0

Check my answer here: https://stackoverflow.com/a/61063514/2254794

Short version: pillow requires libjpeg and libzlib at runtime; django will report any import PIL failure as the error seen above.

tbm
  • 1,142
  • 12
  • 22