Yeah, I did this, it was stupid.

I did not know it will pull its dependencies with it, I just wanted to install python 2 and 3 from scratch (because of this problem: How to change default idle for python?).

Now, I still can use my terminal, checked these answers:

Apt-get remove python ~150Mb / apt-get install python 687kb

I accidentaly did sudo apt-get remove python

However after running sudo apt-get install ubuntu-desktop I get these errors:

Setting up python-ldb (2:1.1.24-1ubuntu3) ...
/var/lib/dpkg/info/python-ldb.postinst: 6: /var/lib/dpkg/info/python-ldb.postinst: pycompile: not found
dpkg: error processing package python-ldb (--configure):
 subprocess installed post-installation script returned error exit status 127
No apport report written because MaxReports is reached already
                                                              Setting up python-tdb (1.3.8-2) ...
/var/lib/dpkg/info/python-tdb.postinst: 6: /var/lib/dpkg/info/python-tdb.postinst: pycompile: not found
dpkg: error processing package python-tdb (--configure):
 subprocess installed post-installation script returned error exit status 127
No apport report written because MaxReports is reached already
                                                              dpkg: dependency problems prevent configuration of python-samba:
 python-samba depends on python-crypto; however:
  Package python-crypto is not configured yet.
 python-samba depends on python-ldb (>= 1.1.2~); however:
  Package python-ldb is not configured yet.
 python-samba depends on python-tdb; however:
  Package python-tdb is not configured yet.

dpkg: error processing package python-samba (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports is reached already
                                                              Processing triggers for libc-bin (2.23-0ubuntu7) ...

Errors were encountered while processing:
 mercurial-common
 python-crypto
 python-dnspython
 python-ldb
 python-tdb
 python-samba
E: Sub-process /usr/bin/dpkg returned an error code (1)

What is the way to restore these dependencies (16.04 LTS)?

marked as duplicate by karel, Zanna, Kevin Bowen, user68186, Eric Carvalho Apr 2 '17 at 13:06

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    Aren't there specific errors listed earlier in the output? Will you please try to post them? Thanks! – mchid Mar 28 '17 at 4:57
  • Yepp, there is sorry. Edited question. – MattSom Mar 28 '17 at 6:02
  • 1
    Try to install the package python-minimal first. It's the one containing pycompile. – Florian Diesch Mar 28 '17 at 7:06
  • @FlorianDiesch Nope, throws the same problem :( – MattSom Mar 28 '17 at 8:31
  • 1
    First, try running: sudo apt-get update; sudo apt-get -f install and if that doesn't resolve things, try running: sudo dpkg --configure -a Please post any errors, thanks! – mchid Mar 28 '17 at 17:42
up vote 2 down vote accepted

Managed to get it done this afternoon.

sudo apt-get install --reinstall python python-chardet python-colorama python-distlib python-django python-django-tables2 python-six python-html5lib python-lxml python-minimal python-pkg-resources python-setuptools python-urllib3 python-requests python-pip python-virtualenv

sudo apt-get install --reinstall python-dnspython

sudo apt autoremove

sudo apt-get -f install

After a whole day of adventures in the deepest pits of internet, these commands worked for me.

python-dnspython and samba was still missing after the first command, --reinstall python-dnspython pulled samba in as well. Autoremove removed the needless dependencies.

  • 1
    The crucial part was likely the reinstallation of python-minimal. In a single short command that's sudo apt-get install -f --reinstall python-minimal. – David Foerster Mar 31 '17 at 6:59
  • Yes, I tried that separately before, but did not work on its own, so you may use the first then autoremove to be sure. Still, you are right, it must be included. – MattSom Mar 31 '17 at 10:31

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