Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

python/django - "Cannot use ImageField because Pillow is not installed"

Tags:

I'm joining a project, so I want to set up the environnment, so what I did is :

pip install -r requirements.txt 

This fully installed all requirements including django 1.7.0, Pillow 2.4.0 and some others.

Then I want to build the database :

python manage.py migrate 

And boom, error, I get the following :

CommandError: System check identified some issues:  ERRORS: stu.chan.icon: (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". stu.chan.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". stu.Piec.icon: (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". 

... like I didn't install Pillow. So I checked the installed package (with this technique), and Pillow 2.4.0 IS installed.

Then, I also tried to force reinstall : pip install --upgrade --force-reinstall Pillow==2.4.0

But, nothing to do I get the same error when running migrate.

I'm using python 3.4.0 and django 1.7.0 on a mac OS X 10.6.7 wrapped in virtualenv 1.11.6 with pip downgraded to pip 1.2.1 (because of some well-known-yet-not-fully-resolved-nor-understood issue with pip and ssl).

All of the code above is within virtualenv (bin/activate done).

Do you have any ideas on why this problem and how to resolve it?

- - - - - - EDIT - - - - - -

When I run the above force-reinstall command, (so many code gets outpouted I can't paste it all but) although it finishes with "Successfully installed Pillow", there's some warnings in the code :

building 'PIL._imaging' extension  (blabla code)     _imaging.c:975:13: warning: array index of '1' indexes past the end of an array (that contains 1 elements) [-Warray-bounds]         value = PyTuple_GET_ITEM(xy, 1);                 ^~~~~~~~~~~~~~~~~~~~~~~     /usr/local/include/python3.4m/tupleobject.h:58:34: note: instantiated from:     #define PyTuple_GET_ITEM(op, i) (((PyTupleObject *)(op))->ob_item[i])                                      ^     /usr/local/include/python3.4m/tupleobject.h:27:5: note: array 'ob_item' declared here         PyObject *ob_item[1];         ^     1 warning generated.  (blabla code)    libImaging/Unpack.c:867:1: warning: unused function 'copy3' [-Wunused-function]     copy3(UINT8* out, const UINT8* in, int pixels)     ^     1 warning generated. 
like image 400
lapin Avatar asked Sep 04 '14 09:09

lapin


People also ask

Does Django require pillow?

Using PIL/Pillow is only required if you want to do image processing.

What is pillow in Django?

Pillow is the friendly PIL fork by Alex Clark and Contributors. PIL is the Python Imaging Library by Fredrik Lundh and Contributors. Pillow for enterprise is available via the Tidelift Subscription.


1 Answers

I was having this problem on a Mac with Python 3.6.4. The solution was to uninstall Pillow 5.1.0 and instead install 5.0.0.

pip uninstall Pillow pip install Pillow==5.0.0 
like image 174
PatrickReagan Avatar answered Oct 22 '22 00:10

PatrickReagan