Fixing – PIL IOError: decoder jpeg not available

June 17, 2009

After a while of trying many different approaches found across the beautiful interweb, I stumbled upon Greg’s post here. I have adapted his post for OS X as he used Ubuntu.

So you get PIL (the Python Imaging Library) all installed on your new system and you’re feeling proud of yourself. But then you go to do some tasks involving JPEG’s and you get this horriffic error:

IOError: decoder jpeg not available

Here’s how I re-installed PIL correctly. But before you try to reinstall it, make sure you’ve removed every ounce of PIL from your system. Somehow the reinstall didn’t work until I removed both the PIL site-packages install AND the temporary installation folder i.e., where the tar file unpacked to.

My sucessful re-installation of PIL on OS X 10.5.7:

First remove your last install!


$ sudo rm -rf /usr/lib/python2.5/site-packages/PIL
$ sudo rm /usr/lib/python2.5/site-packages/PIL.pth
$ sudo rm ~/Imaging-1.1.6

  1. If you haven’t already, you must install the Apple Development Tools (XCode).
  2. Download and install the Unix software installer Fink. The binary installers for the Mac worked great, both on my Intel and PowerPC machines.
  3. Open a Terminal window and type:

    fink install libjpeg
    curl -O http://effbot.org/media/downloads/Imaging-1.1.6.tar.gz
    tar -xzf Imaging-1.1.6.tar.gz
    cd Imaging-1.1.6
    sudo python setup.py install

Get PIL again and do the install:


$ wget http://effbot.org/media/downloads/Imaging-1.1.6.tar.gz
$ gunzip Imaging-1.1.6.tar.gz
$ tar xvf Imaging-1.1.6.tar
$ cd Imaging-1.1.6/
$ python setup.py build_ext -i

Run the included test to make sure everything now works:


$ python selftest.py

If everything worked do the real install:

$ sudo python setup.py install

One Response to “Fixing – PIL IOError: decoder jpeg not available”

  1. Anthony Says:

    Hi,

    Thanks so much for posting this. I’ve got PIL running on my install now…at least to the point where it is not crashing with a decoder error.

    Anthony


Leave a Reply

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

WordPress.com Logo

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

Google+ photo

You are commenting using your Google+ 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 )

Connecting to %s

%d bloggers like this: