Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I tried to remove/add several python packages and always got the error message "Package operation failed" (using the ubuntu software center). When I tried to remove e.g. python-scipy using the terminal, I got the following:

>pcfun27@pcfun27:~$ sudo apt-get remove python-scipy
>Reading package lists... Done
>Building dependency tree       
>Reading state information... Done
>The following packages will be REMOVED:
>  python-scipy
>0 upgraded, 0 newly installed, 1 to remove and 9 not upgraded.
>5 not fully installed or removed.
>After this operation, 22.6MB disk space will be freed.
>Do you want to continue [Y/n]? y
>(Reading database ... 243686 files and directories currently installed.)
>Removing python-scipy ...
>Traceback (most recent call last):
>  File "/usr/bin/pycentral", line 2300, in <module>
>    main()
>  File "/usr/bin/pycentral", line 2294, in main
>    rv = action.run(global_options)
>  File "/usr/bin/pycentral", line 1653, in run
>    runtimes = get_installed_runtimes(with_unsupported=True)
>  File "/usr/bin/pycentral", line 278, in get_installed_runtimes
>    default_version = pyversions.default_version(version_only=True)
>  File "/usr/share/pycentral-data/pyversions.py", line 172, in default_version
>    raise ValueError, "/usr/bin/python does not match the python default version. It
>must be reset to point to %s" % debian_default
>ValueError: /usr/bin/python does not match the python default version. It must be reset 
>to point to python2.5
>dpkg: error processing python-scipy (--remove):
> subprocess installed pre-removal script returned error exit status 1
>Traceback (most recent call last):
>  File "/usr/bin/pycentral", line 2300, in <module>
>    main()
>  File "/usr/bin/pycentral", line 2294, in main
>    rv = action.run(global_options)
>  File "/usr/bin/pycentral", line 1477, in run
>    runtimes = get_installed_runtimes()
>  File "/usr/bin/pycentral", line 278, in get_installed_runtimes
>    default_version = pyversions.default_version(version_only=True)
>  File "/usr/share/pycentral-data/pyversions.py", line 172, in default_version
>    raise ValueError, "/usr/bin/python does not match the python default version. It 
>must be reset to point to %s" % debian_default
>ValueError: /usr/bin/python does not match the python default version. It must be reset 
>to point to python2.5
>dpkg: error while cleaning up:
> subprocess installed post-installation script returned error exit status 1
>Errors were encountered while processing:
> python-scipy
>E: Sub-process /usr/bin/dpkg returned an error code (1)
>pcfun27@pcfun27:~$

I already found similar problems in some mailing lists and forums, but no solution did really help (at all). I also think that this is a quite bigger problem, since I the "Package operation failed" error trying to install/remove any package (even though they do get removed/installed).

I would really appreciate if someone had a hint for me, because I really need to install/remove certain packages to go on working on my thesis.

OS is Ubuntu 10.04 running on a 64-bit machine.

Please tell me if you need further information.

share|improve this question
    
Main error is "ValueError: /usr/bin/python does not match the python default version. It must be reset >to point to python2.5". Please give the output of ls -l /usr/bin/python; which python; ls -l $(which python); python -V; echo $PATH –  medigeek Jan 24 '12 at 9:47
    
Welcome at Ask Ubuntu! Please use the preview below your Textfield while editing - the citation block was unreadable. The <S> button is meant to layout code. –  user unknown Jan 24 '12 at 9:52

2 Answers 2

You basically have to reset the link of /usr/bin/python to point to 2.5:

ls -l /usr/bin/python

sudo rm /usr/bin/python
sudo ln -s python2.5 /usr/bin/python

sudo apt-get update
sudo apt-get -f install
sudo apt-get upgrade
share|improve this answer
1  
The right way to set the system's default python is using the alternatives mechanism instead of creating symlinks manually. Try update-alternatives --config python for an interactive menu. There are other commands to change the preference order, add other options etc. –  Synchro Nov 14 '12 at 16:08
>ValueError: /usr/bin/python does not match
  the python default version. It must be reset 
>to point to python2.5

Did you by incident install a python vesion, which was not the default of your system? You may uninstall it, and reinstall the original version, meant to be used by ubuntu. Ubuntu makes heavy use of python, so it should be kept intact. But you should be able to add a second version in parallel - it just might not be a good idea to make this second version the default.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.