pyversions doesn't honor update-alternatives

Bug #224438 reported by Craig Stimmel
14
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-support (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

Binary package hint: python-support

Using gutsy, which provides python2.5 as the default, I'm working with a piece of software requiring python2.4. I used update-alternatives to set 2.4 to the default:

sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.4 2
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.5 1
sudo update-alternatives --config python

This worked great, until I tried installing python-ldap (as well as other python packages):
ValueError: the symlink /usr/bin/python does not point to the python default version. It must be reset to point to python2.5

Sure enough, /usr/bin/python is (as you would expect):
lrwxrwxrwx 1 root root 18 2008-04-29 14:05 python -> /etc/alternatives/python

I found a workaround (http://www.progprog.com/tags/ubuntu,) but using update-alternatives seems like a valid way of setting the default python and it would be nice for doing so to not break apt-get installs and updates.

Revision history for this message
KLEIN Stéphane (stephane-harobed) wrote :

I've same issue with Jaunty (Ubuntu 9.04).

Revision history for this message
Loïc Minier (lool) wrote :

I'm afraid using alternatives is absolutely NOT supported. The default version of python in the distribution is carefully chosen during the development cycle and it is not possible to change it locally. If you need a particular python version for a program, call this particular version with its versionned name: python2.5 or python2.6 for instance.

/usr/bin/python is a symlink shipped in the python-minimal package and this package's is always supposed to reflect the version of the current python version.

Changed in python-support (Ubuntu):
status: New → Invalid
Revision history for this message
itsadok (itsadok) wrote :

Took me a while to find this (non) bug, so for the benefit of the next person googling:

I got this error message trying to upgrade ubuntu 9.10:
"
Can not upgrade

Your python install is corrupted. Please fix the '/usr/bin/python'
symlink.
"

Turns out /usr/bin/python was symlinked to /etc/alternatives/python.

Fixed with:
sudo ln -sf python2.6 /usr/bin/python

Revision history for this message
kesten broughton (dathomir) wrote :

This is still a "Not my bug" as of Oncelot 11.10.

Somebody at update-alternatives needs to talk to somebody at ubuntu and make this stop happening.
If update-alternatives is potentially going to screw up future upgrades they need to warn about this upon install or get pyversion to handle a double sym link case.

I just got roughly the same error trying to upgrade VirtualBox

ValueError: /usr/bin/python does not match the python default version. It must be reset to point to python2.7

However,

/usr/bin$ ls -al | grep python

lrwxrwxrwx 1 root root 24 2011-12-04 16:16 python -> /etc/alternatives/python

/etc/alternatives$ ls -al | grep python

lrwxrwxrwx 1 root root 18 2011-12-04 16:16 python -> /usr/bin/python2.7

so /usr/bin/python is sym linked to /etc/alternatives/python and this is sym-linked to /usr/bin/python2.7

$ python

Python 2.7.2+ (default, Oct 4 2011, 20:06:09)

[GCC 4.6.1] on linux2

...

>>>

That is, /usr/bin/python points to the correct (default debian 2.7) python, but it does so through 2 symlinks. The extra indirection is messing things up. The bug lies either with the post-installation script (owned by VirtualBox) requesting the version in a way that doesn't support update-alternatives, or with update-alternatives for not conforming to some expected interface requirements. Submitting a bug report to both.

kesten

Revision history for this message
Gabriel (misc-evotex) wrote :

if the system needs a special version then why not just create a /usr/bin/python.system that points to the correct version and all of ubuntu's scripts use that, and /usr/bin/python points to /etc/alternatives/python which points to the version set by the user?

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Related questions

Remote bug watches

Bug watches keep track of this bug in other bug trackers.