The Python Oracle

Getting Django to recognize PIL JPEG support

--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Industries in Orbit Looping

--

Chapters
00:00 Getting Django To Recognize Pil Jpeg Support
01:50 Accepted Answer Score 2
02:43 Thank you

--

Full question
https://stackoverflow.com/questions/1169...

--

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.