Ubuntu lucid lynx does not have Python 2.4 and 2.5 runtimes available in the repositories, so if you are a developer and you are in need of those, then you have two options: One is try to find binaries somewhere else or just compile them from source. In this article, I’m going to point out the steps for compilation.
Go to python.org and download the sources for the version you want. In my case I download Python2.4 Untar the bz2 or gzip file. Go to Python-2.4.4 (my Python version) and cd into Modules. Edit the Setup file and uncomment those modules you need. Amongst them I uncommented the zlib module. You’ll need to install from repos the zlib1g-dev package and the Tcl/Tk one as well. I take for granted you’ve got g++ compiler as well as it is necessary. ./configure, make and sudo make install. Take into account that the python2.4 runtime will be installed in /usr/local/bin/python and /usr/local/bin/python2.4 In my case I deleted the “/usr/local/bin/python” leaving the “/usr/local/bin/python2.4”Β (both are the same) to avoid clashing with the python (2.6) in /usr/bin as apparently the shell looks first in /usr/local/bin.
Manually compiling should indeed work.
Another popular solution to this in the Plone community (and probably the wider Zope community) is to use a special buildout to compile python:
http://svn.plone.org/svn/collective/buildout/python
This creates binaries for python 2.4, 2.5 and 2.6, I think all with readline support installed.
Of course you *do* need some python installed first before you can run this buildout…
The system python2.6 that is still available should work fine for that though.
As far as I know this python buildout was initially created to solve problems with the system python on Mac OS X Show Leopard; that one is apparently not fit for running a zope 2 instance. But it works fine on Linux as well.
Thanks indeed. Actually, what surprised me is that it was really straightforward taking into account that sometimes compilation requires additional dependencies and packages that could end up in a difficult process.
$ /usr/bin/python bootstrap.py
Traceback (most recent call last):
File “boostrap.py” line 113, in
ws.find(kpg_resources.Requirement.parse(requirement)).location
AttributeError:’NonType’ object has no attribute ‘location’
Try installing python-setuptools and re-running bootstrap.py
Your article helped but this is the lazy way i figured for anyone else landing here.
add repository “deb http://us.archive.ubuntu.com/ubuntu/ karmic main restricted universe multiverse”
install python2.5 /2.4
run as “python2.5”
I am using this for appengine.
If you enable the karmik repository in your sources.list when using lucid, then you could end up with a broken system due to version clashes between packages.
There’s a PPA that contains Python 2.4 and 2.5 for lucid. I was hoping to find its name when I stumbled upon this blog page. Oh well, let me ssh into a server that has it enabled and look it up… Here:
sudo add-apt-repository ppa:fkrull/deadsnakes
Thanks! It was way easier to just install python2.4-minimal from the PPA. =)
Damn, forgot
sudo apt-get update on the first try π
Now it works!
thanks a lot! It worked!
π
It’s a good idea to install zlib1g first which is needed for the setup tools to work. Thanks for the advice on removing /usr/local/bin/python .
thanks jordilin,,,
this is help me..
i’m newbie on linux…. π
I came across your blog trying to figure out somethings related to python 2.5 and Ubuntu 10.04.
FYI – I found another blog that has this same post almost word for word.
http://namhuy.org/blog/2010/05/20/python2-4-python2-5-and-ubuntu-10-04-lucid-lynx/
Thanks. I just checked and they’ve got another article of mine posted in that blog. I guess I must not be the only one suffering from this problem. It makes me remember the German case of a PhD plagiarism going around in the news now: http://www.bbc.co.uk/news/world-europe-12489762