Tuesday, July 3, 2012

python-imaging in virtualenv with Pillow

Thanks to Pillow (fork of PIL) it's now easy to run Plone in a virtualenv. Virtualenv is quite convenient if you have different python projects (Plone, Django, Pyramid). (The virtualenvwrapper scripts make it even easier to use.)

I tried to install PIL in a virtualenv, but it could by default not find the image libraries installed on my system (Ubuntu 12.04). I did, of course, install the relevant development libraries, but the result would still be "JPEG support not available". There's tricks to work around that, but really: Pillow is much easier:
$ mkvirtualenv --no-site-packages --python=python2.7 python2.7-Pillow
(python2.7-Pillow) $ easy_install Pillow
And you're ready to run your buildout.