Installing PIL in virtualenv in Ubuntu

To install PIL in virtualenv in ubuntu, these are the steps:

  1. install the dependencies needed to build PIL

    sudo apt-get build-dep python-imaging
  2. then run these commands

    sudo ln -s /usr/lib/i386-linux-gnu/libfreetype.so /usr/lib/
    sudo ln -s /usr/lib/i386-linux-gnu/libz.so /usr/lib/
    sudo ln -s /usr/lib/i386-linux-gnu/libjpeg.so /usr/lib/

    If you’re using 64bit system, switch i386-linux-gnu to x86_64-linux-gnu.

    If you don’t do it, you might see these messages when after building PIL, and you won’t have jpeg support.

    *** JPEG support not available
    *** ZLIB (PNG/ZIP) support not available
    *** FREETYPE2 support not available
  3. Last command, install PIL

    pip install PIL

5 thoughts on “Installing PIL in virtualenv in Ubuntu

  1. Lots of people talking about PIL issues, but this is the post I found most helpful. Worked like a charm. Thanks!

  2. craterdome says:

    Agreed. I’ve looked all over the place, but this is the only thing that worked.
    Nice simple instructions and it fixed my problem. Thanks!

  3. Nassim says:

    Thanks. Works like a charm, no problems in Ubuntu 11.10.

  4. Tomaa says:

    Thanks man! This was a real bail out.

  5. Oli Warner says:

    Much more simple than symlinking into your virtualenv. Just works.

    I do rather wonder why these packages aren’t exposing themselves via /usr/lib/ in the first place.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: