Contact Us

If you are interested in our services leave your contact details below and our sales representatives will contact you.

The organization which you represent
Email address we will use to contact you
Longer contact form…
 
  • About

    mFabrik Blog is about mobile and web software development, open source and Linux. We tell exciting tales where business, technology, web and mobile convergence.

    Creative Commons License
    This work is licensed under a Creative Commons Attribution 3.0 Unported License.

Installing Python Imaging Library (PIL) under virtualenv or buildout

Posted on November 19, 2009  by Mikko Ohtamaa
Filed Under plone, python, technology

I have greatly struggled to have PIL library support in isolated Python environments like virtualenv –no-site-packages.

For example, when installing Satchmo shop under virtualenv:

../bin/clonesatchmo.pyhe Python Imaging Library is not installed. Install from your distribution binaries.
../bin/clonesatchmo.py The Python Imaging Library is not installed. Install from your distribution binaries.

Though it clearly is there, installed by easy_install PIL command:

ls ../lib/python2.5/site-packages/PIL-1.1.7-py2.5-linux-x86_64.egg
ArgImagePlugin.py	 ExifTags.py		  GimpGradientFile.pyc...

Does anyone know if this problem is with PIL itself, eggified PIL or something else?

In any case, there is an easy workaround: use system-wide PIL (sudo apt-get install python-imaging) and symlink PIL from your site-wide installation under the isolated Python environment:

(satchmo-py25)mulli% pwd
/srv/plone/mmaspecial/satchmo-py25/lib/python2.5/site-packages
(satchmo-py25)mulli% ln -s /usr/lib/python2.4/PIL .
That works for now, but I’d like to learn how to make virtualenv and buildout install PIL egg bullet-proof way.
 

Other posts by Mikko Ohtamaa

 

Comments

8 Responses to “Installing Python Imaging Library (PIL) under virtualenv or buildout”

  1. Godefroid Chapelle on November 20th, 2009 1:25 am
    Gravatar

    I have had same time of problem recently which I solved under Mac OSX by easy installing PILwoTk. This makes me believe the standard egg has an issue…

     
  2. Russell on November 20th, 2009 2:11 am
    Gravatar

    I followed the advice from this blog http://davidjb.com/blog/2009/06/virtualenv-plone-and-ubuntu-904-jaunty

    the important part was to run these commands in the virtualenv
    easy_install –find-links http://www.pythonware.com/products/pil/ Imaging
    easy_install –find-links http://download.zope.org/distribution PILwoTK

    Haven’t had time to investigate why it works, but it does.

     
  3. Matthew Wilkes on November 20th, 2009 3:47 pm
    Gravatar

    There are a few options, symlinking a different python’s egg of it isn’t a good idea.

    I do:

    easy_install http://dist.repoze.org/PIL-1.1.6.tar.gz

    which is a repackaging that works with setuptools. Alternatively, download the source distribution and run its install manually:

    $ curl -O http://effbot.org/media/downloads/Imaging-1.1.7.tar.gz
    $ tar zxvf Imaging-1.1.7.tar.gz
    $ cd Imaging-1.1.7
    $ python setup.py install

    Matt

     
  4. Encolpe on November 20th, 2009 6:55 pm
    Gravatar

    It seems that setuptools doesn’t find PIL egg. The solution I found is simplier :

    $ cd /srv/plone/mmaspecial/satchmo-py25/lib/python2.5/site-packages
    $ ln -s PIL-1.1.7-py2.5-linux-x86_64.egg PIL

    This is enough to get it works with your egg and works with all eggs. Why it doesn’t work with this egg… may be ‘x86_64′ that add an underscore where setuptools doesn’t expect to find one.

     
  5. Ian Bicking on November 20th, 2009 8:16 pm
    Gravatar

    Try this repackaged version of PIL: http://dist.repoze.org/PIL-1.1.6.tar.gz

     
  6. Martin on March 3rd, 2010 11:21 pm
    Gravatar

    @Encolpe

    Your solution worked perfectly for me even though I’m using OS X 10.6. I just had to change the name of the egg. Thanks!

     
  7. web development on June 5th, 2010 5:13 am
    Gravatar

    works perfectly! thanks!

     
  8. web development on June 5th, 2010 5:15 am
    Gravatar

    how would you know if you installed the PIL without problems. i just installed PIL using Imaging-1.1.7; python setup.py install.

     

Leave a Reply