1

I have two python in my computer 2.7 and 3.4. I stupidly assumed that 2.7 is the default python in ubuntu and tried to uninstall python3 using this command

sudo apt-get remove python3

While in the middle of the process I saw it removing firefox and other necessary tools, so I panicked and closed the process in the middle. But after restarting my computer I saw that it broke my ubuntu epecially my desktop. Then I have to painstakingly re installed the ubuntu desktop using these codes

#sudo apt-get and sudo dpkg --configure -a these two not working
sudo apt-get -f install  ubuntu-desktop

#after installation
mv ~/.config/dconf/user ~/.config/dconf/user.old

#reboot
sudo reboot

This allowed me to regain my access to the desktop and launcher but when I tried to install other softwares using command line I am getting this error(used both apt-get install and apt-get -f install) and also unable to install from Ubuntu software center.

sudo apt-get install unity-tweak-tool

Reading package lists... Done
Building dependency tree       
Reading state information... Done
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 friends-dispatcher : Depends: python3-pkg-resources but it is not going to be installed
 python3-aptdaemon : Depends: python3-pkg-resources but it is not going to be installed
 python3-chardet : Depends: python3-pkg-resources but it is not going to be installed
 python3-plainbox : Depends: python3-pkg-resources but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

what should I do now? Can I uninstall python 2.7 from my system without harming it? How I install other softwares using command line (eg unity-tweak-tool)?

EDIT

Still after more than 10 hours of searching and teaking the system the problem still exists. Now I have narrowed it to a single problem.

When I tried this

sudo apt-get -f install

the error was pointing to a half installed python3-pkg-resources

Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 41 not upgraded.
1 not fully installed or removed.
Need to get 0 B/31.7 kB of archives.
After this operation, 0 B of additional disk space will be used.
dpkg: error processing package python3-pkg-resources (--configure):
 package python3-pkg-resources is not ready for configuration
 cannot configure (current status `half-installed')
E: Sub-process /usr/bin/dpkg returned an error code (1)

Currently my autoremove dosent work and clean and autoclean return no error. Should I remove python3-pkg-resources? How should I do it and reinstall it?

EDIT2

Searching for solution to fix broken package lead to this answer which recommended removing broken packages using synaptic(which i installed before the problem).

The synaptic package manager shows four broken packages

enter image description here

I then selected a single package python3-plainbox and marked as for removal which then again showed other packages depending on this package enter image description here

the other three broken packages also show some varied packages depending on them. I tried to re install the broken packages using synaptic manager but its throwing error. Should I remove it

Eka
  • 2,967
  • 12
  • 38
  • 60
  • I don't understand the premise of your question; Python 2 is the default Python. Why do you want to uninstall Python 2.7? Bear in mind it is a dependency for many packages, so if you do want to uninstall it, be prepared to uninstall the packages that depend on it. – edwinksl Jul 19 '16 at 07:44
  • k i didnt know that. I currently have low system space so want to remove some softwares so I have two python of different versions and I thought to remove one – Eka Jul 19 '16 at 07:47
  • 4
    no, installing python 2.7 will break your system even more. You need both python 2 & python 3 because they are different and both integral to many programs in Ubuntu – Zanna Jul 19 '16 at 07:47
  • What does apt-cache policy python3-pkg-resources say? – Byte Commander Jul 19 '16 at 08:28
  • @ByteCommander python3-pkg-resources: Installed: 3.3-1ubuntu2 Candidate: 3.3-1ubuntu2.... this is the result – Eka Jul 19 '16 at 10:27
  • But then sudo apt-get install -f should fix it... – Byte Commander Jul 19 '16 at 10:36
  • Nothing its throwing the same error. I cant install any software even tried to reinstall python3 sudo apt-get install -f python3 getting the same error The following packages have unmet dependencies: friends-dispatcher : Depends: python3-pkg-resources but it is not going to be installed python3-aptdaemon : Depends: python3-pkg-resources but it is not going to be installed python3-chardet : Depends: python3-pkg-resources but it is not going to be installed python3-plainbox : Depends: python3-pkg-resources but it is not going to be installed E: Unmet dependencies. – Eka Jul 19 '16 at 10:39

1 Answers1

1

After many hours of searching, tweaking and all other kind of things I have found a solution to this problem

All the below steps are done without rebooting

  • First I removed all the four broken packages using synaptic programme manager(mark as removal).
  • Then I updated my system using these commands

    sudo apt-get update
    sudo apt-get -f upgrade
    sudo apt-get -f install
    sudo dpkg --configure -a
    sudo apt-get install ubuntu-desktop
    sudo apt-get install build-essential
    sudo apt-get install build-essential checkinstall
    sudo apt-get autoclean
    sudo apt-get clean
    
  • The above codes I repeated many times (not in the same order) still I got satisfied and will also recommend other packages to install depending on your problem.

Now after a fresh reboot I am able to install softwares and other packages

sudo apt-get install unity-tweak-tool
Eka
  • 2,967
  • 12
  • 38
  • 60