I am running Ubuntu 11.04. Along with python 2.7 I have also 2.6 and 2.5. I am using 2.5 version to work and deploy my applications on App Engine. I have installed PIL (Python Image library) but despite I have all the dependencies covered it informs me that it cannot support jpeg and the rest of formats. How can I make the libjpeg-dev available to my custom python installation?
12 Answers
The PIL setup.py file if you are trying to install with easy_install the ./configure script is not available. If you open the setup.py in the first lines somewhere are the paths for Jpeg support zlib support etc. I set their values according to my paths of the installed libraries. So the setup.py looks like this before executing it:
37 JPEG_ROOT = "/usr/lib" 38 ZLIB_ROOT = "/usr/lib/zlib/lib" 39 TIFF_ROOT = None 40 FREETYPE_ROOT = "/usr/lib/i386-linux-gnu/"I have manually installed zlib under /usr/lib/zlib to serve my needs.
The selftest.py of PIL will recognize the available libraries. Recompile PIL and everything is set!
I found it simpler/nicer to add symlinks to the non-standard Ubuntu library locations:
sudo ln -s /usr/lib/x86_64-linux-gnu/libfreetype.so /usr/lib/
sudo ln -s /usr/lib/x86_64-linux-gnu/libz.so /usr/lib/
sudo ln -s /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib/(your .so locations may vary; try locate libjpeg.so etc to find them if necessary)
Reinstalling PIL after fixing these worked fine for me.
-- also simpler for virtualenv installations where setup.py isn't readily editable