PloneSustainable SoftwareSetting Up Python For Plone On Jaunty

April 30th, 2009

After upgrading my local machines to Ubuntu Jaunty, I found that all of my Plone test environments failed to start. It turns out that Ubuntu packages such a python-imaging, python-xml and python-ldap quietly drop support for python 2.4 in Jaunty. Here is how I got Plone running.

We run a mixture of Plone 3.0.x and 3.1.x at the moment. We use buildout for Plone 3.1 and the old ‘static’ install method for Plone 3.0 (stick stuff in the Products directory). This technique works for both cases.

After flailing around in a mild panic for a while, I found an article by Maurits van Rees thatt mentions a couple of techniques to deal with Plone on Jaunty. This put me on to the Ubuntu python-virtualenv package that provides a tool to create custom python setups. This turned out to be an excellent way of controlling my python2.4 packages:

Install it:

  sudo apt-get install python-virtualenv

Create an environment:

  virtualenv -v -p python2.4 ~/apps/py24

Install elementtree:

  ~/apps/py24/bin/easy_install elementtree

Easy_setup did’t seem to work for  libxml2 suport, so I did it the old-fashioned way instead:

  wget ftp://xmlsoft.org/libxml2/libxml2-2.6.32.tar.gz

Unzip that, cd into the ‘python’ subdirectory inside it, and:

  ~/apps/py24/bin/python ./setup.py install

PIL was equally obstinate. PIL complains about not having JPEG and Freetype support if you don’t install these first (perhaps you don’t need them – I didn’t care to find out):

  sudo apt-get install libjpeg-dev libfreetype6-dev

then:

  wget http://effbot.org/downloads/Imaging-1.1.6.tar.gz

… unzip … cd in …

  ~/apps/py24/bin/python setup.py install

Modifying your Zope instances to use the new python environment is easy. If using buildout:

  ~/apps/py24/bin/python bootstrap.py
  ./bin/buildout

Otherwise you need to change the location of the python executable in all of your Zope startup scripts (i.e. zopectl, etc.).

Finally, if you need LDAP support:

  ~/apps/py24/bin/easy_install python-ldap
Posted in Plone, Sustainable Software | 5 Comments »

5 Responses to “Setting Up Python For Plone On Jaunty”

  1. Dan Martin Says:

    Thanks for the guide. I can’t believe plone3-site is even in the Ubuntu repos in a completely unusable state. An addendum, to get your libxml2 instructions to work, I first had to:

    sudo apt-get install libxml2-dev

  2. Dan Martin Says:

    I had to do this one more time, but this time the system was a completely clean Jaunty install, and this process required one more step:

    sudo apt-get install python2.4-dev

  3. Sam Stainsby Says:

    The python2.4-dev step has been required for Plone on Ubuntu for a long time.

  4. Dan Martin Says:

    It isn’t a dependency of the plone3-site package in Ubuntu Jaunty. The result of not having it was an inability to perform the libxml2 “setup.py install” step, and the resulting error messages were quite cryptic. I figured it out only by educated guessing.

  5. Sam Stainsby Says:

    Ah yes, I didn’t realise you were still trying to use the Ubuntu packages for Plone. I gave up on Ubuntu’s Plone packages ages ago – despite the fact I usually adhere strictly to standard Ubuntu packages.