Profile

Paul Annesley This is the personal website of Paul Annesley, senior developer at 99designs in Melbourne, Australia. You can follow Paul on Twitter.

Recent Bookmarks

  • Semantic Versioning » Simple version number specification for systems which expose a public API. The format is major.minor.patch (e.g. 3.0.12); major indicates backwards incompatible, minor indicates backwards compatible, and 0.x.x indicates rapid development.
  • The Go Programming Language » New programming language from Google: performance like C, dynamic like Python, concurrent like Erlang.
  • node.js » Event driven network IO for V8 JavaScript.
  • v8 JavaScript Engine » Google's JavaScript engine as seen in Chrome, runs standalone or embedded in C++
  • jaml - GitHub » Jaml tries to emulate Ruby’s Haml library, making it easy to generate HTML in your JavaScript projects.
  • proxymachine - GitHub » Awesome looking Ruby/EventMachine TCP proxy from GitHub that does content-based routing to a backend. Opens a proxy to a backend once the read buffer contains enough information for a ruby block to return the desired backend address.
  • sstrudeau's jquery-dropper at master - GitHub » jQuery plugin, uses Canvas to provide an "eye dropper" color picker for same-domain images based on their pixel data.
  • Cloudvox - API-driven phone calls » Make and receive calls with JSON over RESTful HTTP, with flexible pricing.

People

  • James Annesley » Maker and purveyor of fine jazz saxophone music in Melbourne, Australia

Django and Python Imaging Library (PIL) on Leopard

19 November 2007

Chapter 5 of the excellent Django Book makes use of django.db.models.URLField().

When running under the default Python 2.5 environment shipped with Mac OS 10.5 Leopard, this causes an error something along these lines:

$ ./manage.py validate
Error: One or more models did not validate:
books.author: "headshot": To use ImageFields, you need to install the Python Imaging Library. Get it at http://www.pythonware.com/products/pil/ .

Assuming you've installed XCode (go on, you know you want to..) this can be solved like so:

Install libjpeg

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

Install Python Imaging Library (PIL)

wget http://effbot.org/media/downloads/Imaging-1.1.6.tar.gz
tar zxvf Imaging-1.1.6.tar.gz 
cd Imaging-1.1.6
sudo python setup.py install

Not too hard, but still, sucks to be us Apple users sometimes. If my Ubuntu Server virtual machine didn't make my laptop run so damn hot, I'd be using that. Are tickless kernels and PowerTOP helping anyone on this front yet?

If it all looks too hard, I'm sure MacPorts (or is it DarwinPorts? who knows) will hold your hand.

Comments

This post has 10 comments.

  1. 04 December 2007

    I forgot that Leopard still doesn't come with wget. It compiles and installs cleanly from source under Tiger and Leopard (./configure && make && sudo make install), or you could probably s/wget/curl -O/ in the instructions above.

  2. 10 December 2007

    Thanks for this, now it looks like the URL for PIL has changed to http://effbot.org/media/downloads/Imaging-1.1.6.tar.gz

  3. 11 December 2007

    The permanent redirect they were serving from the old URL should have taken care of the change, but I've updated the post - Cheers.

  4. 06 January 2008

    Looks like there is an issue with libjpeg installation

    sudo make install-lib
    /usr/bin/install -c -m 644 jconfig.h /usr/local/include/jconfig.h
    install: /usr/local/include/jconfig.h: No such file or directory
    make: *** [install-headers] Error 71

  5. 14 May 2008

    Thanks for this post. My own preference is to install from packages. That being said, I had some difficulty using pypi's easy_install to install PIL.

    A solution I found that worked for me is available here: http://emmby.blogspot.com/2008/05/installing-python-pil-on-mac-os-x-1052.html

  6. 23 June 2008

    I had a few permission errors so i installed via macports however I had to stop the python installl, im not to happy about installing an entire other python version. Is there a way to install it from the macports distro? like, draging /opt/local/pil into /usr/local/pil ?

  7. 03 July 2008

    Nice and simple. I enjoy finding guides that don't use all those pre-compiled macports and darwinports packages. Sometimes it is just easier to build from source.

  8. 17 August 2008

    I am having the same problem as Gavi:

    sudo make install-lib
    /usr/bin/install -c -m 644 jconfig.h /usr/local/include/jconfig.h
    install: /usr/local/include/jconfig.h: No such file or directory
    make: *** [install-headers] Error 71

  9. 28 August 2008

    Luke and Gavi-I had the same problem. You need to create the /usr/local/man folder. Try these commands:
    sudo mkdir /usr/local/man
    sudo mkdir /usr/local/man/man1

  10. 20 September 2008

    Alas, comments are closed due to spammers that are getting past Akismet filtering.

    Thanks everyone for chiming in.