Django, PIL and Virtualenv


I had some trouble using the ImageField in Django with virtualenv because I was getting the following error:
"Upload a valid image. The file you uploaded was either not an image or a corrupted image.” 

PIL was installed in  my virtualenv but I did not pay any attention to the PIL Setup Summary, which was showing that there was not JPEG support.

I tried reinstalling PIL but I had the same final result. I solved my problem in two simple steps.

1)I’ve removed PIL from my virtualenv:
pip uninstall virtualenv

2)I’ve installed pillow, which is a saner package of PIL.
pip install pillow

It solved my problem and now the error in Django is now successfully eliminated.

You can find another useful post about the same issue here.

Advertisements