Python – PIL /JPEG Library: “decoder jpeg not available”

djangolibjpegpythonpython-imaging-libraryredhat

I tried to use PIL to do some JPEG work in my django app with PIL but I'm getting this IOError.. not sure what to do.

""decoder jpeg not available""

Am I missing the JPEG decoder from my server? If so, how do I fix it?

Best Answer

I have found this answer from author "edward"

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:

for x64 OS

pip uninstall PIL
sudo apt-get install libjpeg8-dev
sudo ln -s /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib
pip install PIL

for x32 OS

pip uninstall PIL
sudo apt-get install libjpeg8-dev
sudo ln -s /usr/lib/i386-linux-gnu/libjpeg.so /usr/lib
pip install PIL

I confirm that this is working for me on Ubuntu Linux 12.04.


If you are a Mac user - you need to install Xcode and Command Line Tools. Read how to do this