Posts Tagged ‘OS X’

Python PIL error IOError: decode jpeg not available and encode jpeg not available

June 1, 2010

Just working through Toby Segaran‘s book Collective Intelligence.

Stumbled across this error (OS X 10.5.8) , I fixed it by:

Remove the current PIL installation:

cd /Library/Python/2.5/site-packages/
sudo rm -rf PIL
sudo rm PIL.pth

Remove the Images directory which you extracted to perform the installation (e.g. $HOME/Downloads/Imaging-1.1.7)

Now you need to ensure JPEG library is installed, I use mac ports:

sudo port install jpeg

Now extract your Imaging file and change directory into the new directory (Imaging-1.1.7):

sudo python setup.py install

then run it again!

python setup.py build_ext -i

now run the test:

python selftest.py.

My thanks go to a post by Simon Wilder’s blog which eased my frustration!