When Ubuntu's Package Manager Dies with Python
There might be a day that your python is totally messed up and you won't be able to do any apt-get install
. The situation is even worse if you haven't updated the server for a year or two and you are running Ubuntu Server 12.04. What would you do ? You will have a lot of chrome tabs open ! :)
- Recreate your
sources.list
:vi /etc/apt/sources.list
and replace the content with the list from this generator. Make sure to make a backup first from thesources.list
file. - Compile Python 2.7 from source so the system uses that. Use this guide.
- Then try
apt-get install python-dev
. Then if it tells you there are unmet dependencies, look at the first dependency and doapt-get install
on it. - Then if you get an error message like:
Could not perform immediate configuration on 'python-minimal'.Please see man 5 apt.conf under APT::Immediate-Configure for details
Then do this:
apt-get install libglib2.0-dev # or the name of the package
apt-get upgrade
apt-get install -o APT::Immediate-Configure=false -f apt python-minimal
-
If everything went well, install pip, quick and dirty with
easy_install pip
(Use virtual python or something else if you prefer) -
Then do
which pip
to see if pip is in path. After that dopip install pycurl
. That is the package that is necessary for system's package manager to work properly. -
Now test it for example by updating your php:
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php5-oldstable
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install php5
Now you can close all the tabs that you have open on chrome :)
sources:
1: Tytus Kurek's blog: Could not perform immediate configuration of 'python-minimal' -