PIL on Leopard, or How I made PIL happy

by Jeremy Jones

First off, the "I" in the title does not refer to me; it refers to my coworker Jenny Walsh. Jenny was recently setting up a new Macbook Pro with Leopard on it and ran into a snag with PIL. Running setup.py for PIL for the first time said that she had no jpeg support. So, she installed libjpeg and tried again. This time, it said that she had jpeg support, but then it threw this error:


ld: in /Developer/SDKs/MacOSX10.4u.sdk/usr/local/lib/libJPEG.dylib, file is not of required architecture for architecture ppc


She tried compiling libjpeg and followed suggestions she had found from across the interweb including compiling as a "fat binary" (intel and ppc), but she still had the same level of unsuccess as before. Finally, in a fit of hacking frenzy, she removed all "-arch ppc " from
/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/config/Makefile,
re-ran setup.py for PIL, and all was right with her world again.

In trying to diagnose and help her with her problem, I stumbled across
this
blog post
. They didn't seem to have any trouble getting PIL and libjpeg installed on leopard. The compiled libjpeg as follows:


wget http://www.ijg.org/files/jpegsrc.v6b.tar.gz
tar zxvf jpegsrc.v6b.tar.gz
cd jpeg-6b/
./configure
make
sudo make install-lib


I tried the same thing on my laptop (which runs Tiger and not Leopard, btw), and it worked for me. But this just took my PIL installation from saying that it did not have jpeg support to saying that it did. Jenny was having a different problem. So, if you are having a problem with PIL blowing up when trying to set it up, you may want to give Jenny's solution a spin. But make sure to make a backup copy of the Makefile.