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 Ubuntu 7.04:
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
Make sure you install at the libraries for both JPEG support and FreeType2:
$ sudo aptitude install libjpeg libjpeg-dev
$ sudo aptitude install libfreetype6 libfreetype6-dev
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
If my instructions still don’t help you, in your downloaded PIL archive you can also take a look at the included README file and read the comments in the included setup.py file for more setup instructions.