title: How to install PIL in Ubuntu 11.04?
body: <p>I see this question asked all over the internet, and I've tried following them all, but I still can't get PIL to work. </p>
  
  <p>I tried symbolically linking the zlib, jpeg, etc. libraries via:</p>
  
  <pre><code>sudo ln -s /usr/lib/x86_64-linux-gnu/libfreetype.so /usr/lib/
  sudo ln -s /usr/lib/x86_64-linux-gnu/libz.so /usr/lib/
  sudo ln -s /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/lib/
  </code></pre>
  
  <p>I tried editing the <code>setup.py</code> file, adding this line:</p>
  
  <pre><code>add_directory(library_dirs, "/usr/lib/x86_64-linux-gnu")
  </code></pre>
  
  <p>In fact, running <code>$ sudo python setup.py install</code> shows that JPEG, ZLIB/PNG, etc. support is Available. (I'm installing it for both 2.5 and 2.7, works in neither)</p>
  
  <pre><code>sudo python2.5 setup.py install
  running install
  running build
  running build_py
  running build_ext
  --------------------------------------------------------------------
  PIL 1.1.7 SETUP SUMMARY
  --------------------------------------------------------------------
  version       1.1.7
  platform      linux2 2.5.6 (r256:88840, Feb  1 2012, 15:55:08)
                [GCC 4.5.2]
  --------------------------------------------------------------------
  *** TKINTER support not available
  --- JPEG support available
  --- ZLIB (PNG/ZIP) support available
  --- FREETYPE2 support available
  --- LITTLECMS support available
  </code></pre>
  
  <p>But after all that, I <em>still</em> get a <code>decoder %s not available</code> error. </p>
  
  <p>I'm at my wits end. Anything else I might have missed?</p>
  
  <p>My environment: 
  <strong>64-bit Ubuntu 11.04</strong> running in a VirtualBox VM. </p>
  
  <p>Here's what I do to test if PIL works or not</p>
  
  <pre><code>$ python
  &gt;&gt;&gt; from PIL import Image
  &gt;&gt;&gt; im = Image.open("photo.jpg")
  &gt;&gt;&gt; im.rotate(45)
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  File "/usr/local/lib/python2.7/dist-packages/PIL/Image.py", line 1359, in rotate
    self.load()
  File "/usr/local/lib/python2.7/dist-packages/PIL/ImageFile.py", line 189, in load
    d = Image._getdecoder(self.mode, d, a, self.decoderconfig)
  File "/usr/local/lib/python2.7/dist-packages/PIL/Image.py", line 385, in _getdecoder
    raise IOError("decoder %s not available" % decoder_name)
  IOError: decoder zip not available
  &gt;&gt;&gt; 
  </code></pre>