Saturday, October 24, 2009

Building PIL-1.1.6 on Mac OS X 10.6

I was trying to get the Python Imaging Library installed on Snow Leopard. (This is for a "Python from" environment separate from Apple standard and Macports.) I read a number of posts on the net, but it took a combination of ideas I found to arrive at a solution that worked.

Prerequisites: Install Xcode from the Snow Leopard disk. As you do that, make sure you check the box that enables continued 10.4 SDK support.


$ curl -O
$ tar zxf Imaging-1.1.6.tar.gz
$ sudo bash
# cd Imaging-1.1.6
# export ARCHFLAGS="-arch i686"
# export CFLAGS="-arch i686"
# python build
# python install
# exit

I don't like the cheap trick ("sudo bash"), but I found I needed the ARCHFLAGS and CFLAGS settings for both the build and install steps.

See also Rich Atkinson's use of pip on his blog post. That might be all you need.


wdarkk said...

Thanks, I had the exact same problem heh.

sevenseeker said...

Howdy! Thanks for this info, I too have been trying for weeks with an exhaustive list of combinations.

I tried this and it doesn't work for me due to the following:
ld: in /sw/lib/libiconv.2.dylib, file is not of required architecture for architecture ppc

oddly when building PIL, it uses the build directory of: build/lib.macosx-10.3-fat-2.6

and I get a warning about:
/usr/include/AvailabilityMacros.h:108:14: warning: #warning Building for Intel with Mac OS X Deployment Target < 10.4 is invalid.

do I need to first muck with the lib/python2.6/config/Makefile settings?

Goldy said...

I am not that experienced with command line, and have read countless posts on how to solve it. This is the only one that worked. Thanks!

Shadow said...

Running OS X 10.6.4 on a 64 bit system (Macbook Pro), and I was also getting the Deployment Target < 10.4 error. I solved it by having Xcode installed and running the following:

sudo env ARCHFLAGS="-arch x86_64" CFLAGS="-arch x86_64" python install

(In the PIL source's directory)

Christopher said...

Thank you! I appreciate the post. :)

Jesse said...

Thanks for the post, and thanks Shadow for the update - with shadows added note, I was able to get this working!

Шолеров Владислав said...

Respect to U! It really works!

pilover said...

Thanks my lord.. it even work for PIL-1.1.7 with python 2.6

mahasiswa teladan said...

hi...Im student from Informatics engineering nice article,
thanks for sharing :)