Making a python 2.4 virtualenv buildout on Ubuntu 10.4 & Debian 7 as of 2014-03

published Mar 16, 2014 11:20   by admin ( last modified Mar 18, 2014 01:05 )

It gets harder and harder to install a python 2.4 buildout on Ubuntu and Debian. Basically, the different scripts involved will try to execute code that is not compatible with python 2.4 at every step of the way. I need python 2.4 for some old Plone 2.5 sites. Here is what I did to get it running this time, tested both on Ubuntu 10.4 and Debian 7:

Use a separate virtualenv script, so do not rely on the one installed in the system which is made for another python version. Instead download a standalone script of some vintage:

wget --no-check-certificate https://raw.github.com/pypa/virtualenv/1.7.2/virtualenv.py

Setup the virtual environment like so:

python2.4 virtualenv.py .

It will crash when trying to install setuptools, but by then it has installed python.

Now you should have a working python.

Time to install a setuptools that actually works. Version 1.4.2 works (somewhat selected at random, you can try newer ones if you like). That version is not linked from the https://pypi.python.org/pypi/setuptools page, but with some detective work it can be found at:

https://pypi.python.org/packages/source/s/setuptools/setuptools-1.4.2.tar.gz

Download and unpack it and install it in the old-fashioned way:

./bin/python setuptools-1.4.2/setup.py install

Time to install easy_install. Download the script from:

http://peak.telecommunity.com/dist/ez_setup.py

Then install easy_install with:

./bin/python ez_setup.py

Time to install zc.buildout:

./bin/easy_install zc.buildout==1.4.4

In your buildout.cfg file, you must also pin setuptools to the version you have installed. Otherwise, you guessed it, zc.buildout will download and fail to run a newer incompatible version of setuptools:

[versions]

setuptools = 1.4.2

And there you go:

./bin/buildout