Update: The below no longer applies. A fix has been released. (So you can undo any ugly hack you used in order to make it work.)

Dear Python developers,

when upgrading to Ubuntu 9.04 (Jaunty Jackalope, which is to be released in 22 days from now) please keep in mind that python-virtualenv (the tool we all know and love) is broken. It still works with python2.5, though.

While trying to resolve this issue I had several ideas:

  • Deinstall python2.6 so python2.5 is used instead. This turned out to be a bad idea.
  • Some may be used to update-alternatives. This can’t be used for python.
  • If you just change the symlink /usr/bin/python from /usr/bin/python2.6 to /usr/bin/python2.5 it will first seem to work, but some tasks will fail. E.g. when installing python2.5-dev, you will get the following error: ValueError: /usr/bin/python does not match the python default version. It must be reset to point to python2.6
  • You then need to do another ugly workaround.

I am not sure whether this will wreak further havoc, so please be cautious. I hope that we can get this fixed until Jaunty is released. There is a bug report.

Just letting you know. Took me some time to realize.

6 comments Apr 1, 2009 1:45:00 PM planet-ubuntu

Comment by Manish Sinha — Apr 1, 2009 3:16:05 PM | #- re

I use APTonCD for creating an offline repo of the cached apt packages. It works with Python 2.5 , but Jaunty includes 2.6 which makes this package useless. Dependency failure is what I get every time I try to install my fav application.

There needs to be some way out of this mess. Most of the Python based Frameworks,Toolkits are build for 2.5 and most of them arn’t available for 2.6.

Comment by nixternal — Apr 1, 2009 3:44:10 PM | #- re

Another work around, which might not be as ugly, is to go into the executable of Virtualenv and change the ‘#!/usr/bin/python’ to ‘#!/usr/bin/python2.5′. This has worked on a couple of applications for me during the 2.5->2.6 upgrade in Jaunty.

Comment by Gavin Carothers — Apr 1, 2009 5:07:35 PM | #- re

These would be poor solutions. If you need to setup a virtualenv and don’t mind using python2.5 simply tell virtualenv to use the python2.5 binary. Everything will work perfectly if you do that. Example: virtualenv –python=python2.5 py25-ve

Comment by dennda — Apr 1, 2009 6:51:00 PM | #- re

It’s ugly, without doubt.

@nixternal: That’s probably the less ugly way, but still ugly (as you already mentioned).

@Gavin Carothers: I totally agree. They are not solutions, but ugly workarounds. You are not the first to mention such a parameter. My installation of virtualenv (via apt) does not have a -python, -p or –python parameter though. In addition to that, the workaround you propose does not work if some script (I had that case with a bootstrap script) just uses virtualenv. You’d need to adjust that script as well.

Comment by kklimonda — Apr 1, 2009 7:56:47 PM | #- re

1) virtualenv in Ubuntu is in some ancient version (1.1 or even 1.0) and it doesn’t even work with standard python 2.6 installation, it also doesn’t have -p/–python flag.. 2) Maintainers of Python 2.6 in Ubuntu (or even Debian - I’m not sure who made those changes) had additionally patched python and setuptools to fix some issues (tinyurl.com/dm9y4g) and broken virtualenv completely.. I guess there are no Python developers in MOTU group.. ;)

Comment by marco modem wifi — Jul 3, 2009 2:34:33 PM | #- re

i agree with you when you said that there are no solution…that said several people and i think than anybody have solved this problem yet… so we have to wait. bye