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
- If you haven’t already, you must install the Apple Development Tools (XCode).
- Download and install the Unix software installer Fink. The binary installers for the Mac worked great, both on my Intel and PowerPC machines.
- 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



August 2, 2009 at 8:00 pm
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