Thursday, April 12, 2007

PIL

Lest I fall into the forget-about-updating trap again, I'm going to post an update about the past 5 days or so. I'll enter these as 3 separate entries as they're really 3 separate topics, though in reality I'm typing them all out between compiles at work.

On Saturday, I setup PIL, the Python Imaging Library. We're using it for thumbnails. Unfortunately, PIL is a real pill to install. I must've spent close to a day on it, Googling for everything I could find and looking through several config files.

In the end, my problems were due to 3 problems:
  1. PIL requires libjpeg to operate on JPEG files. And the Debian package is not sufficient; it must be downloaded and built from source
  2. libjpeg must be installed with the "make install-lib" command. The standard make install doesn't cut it.
  3. PIL's setup.py will tell you that it successfully installed JPEG support even when it didn't.
Unfortunately, problem #3 masked problem #2, which led to a long wild-goose chase. I only found the problem when I tried a "python setup.py build_ext -i", which fails properly if libjpeg is not correctly installed. It at least told me that the header files were missing, which led me to read libjpeg's README file more carefully and fix the problem.

In my Googling, I found that many other people have had the same problem, and the PIL developers have been very unhelpful in resolving it. So once I make this public and Google indexes it, perhaps it'll prove useful to folks.

No comments: