Getting Django to recognize PIL JPEG support
--
Music by Eric Matyas
https://www.soundimage.org
Track title: Puzzle Game Looping
--
Chapters
00:00 Question
02:26 Accepted answer (Score 2)
03:30 Thank you
--
Full question
https://stackoverflow.com/questions/1169...
Question links:
[Django ImageField "Upload a valid image. The file you uploaded was either not an image or a corrupted image."]: https://stackoverflow.com/questions/7606...
[Why can't I upload jpg files to my Django app via admin/?]: https://stackoverflow.com/questions/1402...
[Uploading a JPEG image via Django displays error]: https://stackoverflow.com/questions/9271...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #django #pythonimaginglibrary #virtualenv #libjpeg
#avk47
ACCEPTED ANSWER
Score 2
It turns out that this whole thing is my fault due to a misunderstanding of how pip actually works. By habit, I associate any and all installations with superuser privileges, which was not only not necessary in this case, but a recipe for confusion.
The first time I installed PIL, I did not prefix it with sudo, but I did each time after. Thus, building from Meitham's advice, I checked to see where the import was coming from. It came from the correct place, but it did not have the extensions I desired, despite the post-installation output saying I did. Long story short, I removed the directory from my site-packages, then pip freeze continued to tell me I did not have PIL but sudo pip install told me I did.
Lesson learned: virtualenv is based in the user's directory, on the user's privileges. Think twice before combining sudo and pip in the same command.