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

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 install

then run it again!

python build_ext -i

now run the test:


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


Tags: , , ,

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: