Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I deleted python from Ubuntu 14.04 and now my unity desktop is gone. I can't close any files I have open. The only way I can run commands is by using xterm. I still have access to my files, which is a good thing because I have programming assignments and other related school documents I can't afford to delete. I've tried everything to restore unity desktop. when I run apt-get install ubuntu-desktop I'm always receiving

Could not find Platform independent libraries prefix
Could not find Platform dependent libraries exec-prefix
E: sub-process /usr/bin/dpkg returned an error code (1)".

I don't have much time to invest in finding a fix. What is the best alternative in getting my system up and running again, considering I don't want to delete my school files?

share|improve this question
I am not able (nor willing ;)) to test what happens when I remove python so if the commands do not work PM me! – Rinzwind Feb 14 at 19:56

2 possible ways. The 1st is a generic method that will take the same time as a normal install and will always work.

Boot a live DVD. During the partition setup do NOT tick ANY of the "format" checkboxes and have the system install. Mount the partitions to the names you currently have and set it up with the same username.

This will overwrite any system related file, leave all your configuration files and leave your /home/ as it is.

Mind though: making a backup is always the preferred method. You can do that from a live DVD too (take a blank DVD and use Brasero to burn your files or use a stick to copy files over to it).

You might like to try this first: "Could not find Platform independent libraries prefix" will show up when you are missing /usr/lib/python2.7.

This should be a fix for that:

cd ~/Downloads/
apt-get download python2.7 python2.7-minimal libpython2.7
sudo dpkg -i python2.7_*.deb python2.7-minimal_*.deb libpython2.7_*.deb

After that you should also be able to do a sudo apt-get install -f ubuntu-desktop to get a working desktop. Just to be sure that you installed the most up to date python packages, run sudo apt-get update && sudo apt-get dist-upgrade.

You can do the commands on another Ubuntu machine or download the files using a browser and then copy them over to the system you want them installed. The 3rd command installs it.

share|improve this answer
+1 For the 2nd alternative. I corrected and narrowed down a few things. – David Foerster Feb 15 at 9:15
@DavidFoerster thanks :-) You shall be rewarded – Rinzwind Feb 15 at 10:47

First, you need an Ubuntu Live media. It's the same CD/DVD/USB used to install it. Also get a spare flash drive/external drive/CD/DVD to make the backup. If your installation media is a USB drive, you can make a second partition out of it to keep your files.

We'll also need some information, such as your Ubuntu partition name. Consider some factors:

  • Do you have a separate /home partition? If so, discover its name.

  • If you don't have a separate /home partition, discover the root (/) partition's name.

The "name" is the path to the partition's special device file, something like /dev/sda1. You should know it at this point. Take note of it.

Boot into your Live media and insert your backup drive. We'll need to discover its "name", too. To do it, you can run df -aTh in a terminal. You will find information about mounted filesystems, find your backup media and take note of it. Again, it should be something like /dev/sdb1.

In a terminal, run:

sudo mount /dev/sdXY /mnt`

replacing /dev/sdXY with Ubuntu's partition name. Then

sudo umount /dev/sdAB

replacing /dev/sdAB with the backup media.

sudo mkdir /backup

sudo mount /dev/sdAB /backup

sudo mkdir /backup/ubuntu_backup

sudo cp -rf /mnt/home /backup/ubuntu_backup

The above command may take some time, since it's the actual backup.

When it finishes, the backup is ready. Make sure by running nautilus /backup/ubuntu_backup and making sure all you home folders and files are there. Run:

sudo umount /mnt

sudo umount /backup

You can proceed to reinstall Ubuntu from the Live media you're currently running, formatting the old Ubuntu partition Make sure you create your admin user with the exact same name you had before. When it finishes, reboot to the Live media and not to the installed Ubuntu OS. From the Live media, in a terminal, run:

sudo mount /dev/sdXY /mnt

sudo umount /dev/sdAB

sudo mkdir /backup

sudo mount /dev/sdAB /backup

sudo rm -rf /mnt/home

sudo cp -rf /backup/ubuntu_backup/home /mnt

again, the above will take a bit of a time. It's copying the backup to the freshly installed system.

When it finishes, simply reboot into Ubuntu and all your files (including Desktop icons) should be there.

NOTE: the backup won't keep your installed apps/software. You should take note of them to reinstall later.

Never remove Python. It's essential for Ubuntu core functionality. As a rule of thumb, never delete anything that comes with Ubuntu.

Have a nice day.

share|improve this answer

Your Answer


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.