Currently I'm installing PIL into my virtual env as follows:
pip install -E . -r ./releases/%s/requirements.txt
where requirements.txt contains:
pil
I can upload png images but not jpeg images currently. From reading on the web it seems i may need libjpeg decoder? Am i installing pil incorrectly? What is the proper way to install pil for django in a virtual env with libjpeg?
if pip raises an error, try easy_install PIL
You should install the libraries that others recommended but most importantly you should tell PIL where to find them. Edit the setup.py so that
becomes
I found that the easiest way was to download the source with pip but not install:
edit the setup (inside the build directory of the virtual environment) and the install
you can find some more information in my blog
You can also try pillow which seems to do great job with little hassle (pip install pillow)
For Ubuntu 11.04, what finally worked for me is:
The Python Imaging Library (PIL) seems really picky about version and location of the jpeg libraries. And because PIL is written in C and compiled, you need the development versions of the library in addition to the runtime versions.
The situation is so bad the community forked PIL to create a softer version: Pillow: http://pypi.python.org/pypi/Pillow#why-a-fork
You must install the libraries:
On OSX, I used the following binary to get libpng and libjpeg simultaneously installed systemwide:
libpng & libjpeg for OSX
Because I already had PIL installed (via pip on a virtualenv), I ran:
This resolved the
decoder JPEG not available
error for me.On Ubuntu precise, PIL doesn't find the jpeg library files, even once they are installed. The easiest way to fix this is to make a symlink after you have installed the jpeg dev package. So, I needed an extra step: