5

I encounter a long list of errors ending with E: Sub-process /usr/bin/dpkg returned an error code (1) whenever I try to run sudo apt-get ... and I can't figure out why. For example:

Setting up python-gobject-2 (2.28.6-12ubuntu1) ...
/var/lib/dpkg/info/python-gobject-2.postinst: 6:    /var/lib/dpkg/info/python-gobject-2.postinst: pycompile: not found
dpkg: error processing package python-gobject-2 (--configure):
 subprocess installed post-installation script returned error exit status 127
Setting up python-cairo (1.8.8-2) ...
/var/lib/dpkg/info/python-cairo.postinst: 6: /var/lib/dpkg/info/python-cairo.postinst: pycompile: not found
dpkg: error processing package python-cairo (--configure):
 subprocess installed post-installation script returned error exit status 127
dpkg: dependency problems prevent configuration of python-gtk2:
 python-gtk2 depends on python-cairo (>= 1.0.2-1.1); however:
  Package python-cairo is not configured yet.
 python-gtk2 depends on python-gobject-2 (>= 2.21.3); however:
  Package python-gobject-2 is not configured yet.

dpkg: error processing package python-gtk2 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python-liblarch:
 python-liblarch depends on python-gobject-2; however:
  Package python-gobject-2 is not configured yet.
 python-liblarch depends on python-gtk2; however:
  Package python-gtk2 is not configured yet.

No apport report written because the error message indicates it's a follow-up error from a previous failure.
                                  No apport report written because MaxReports has already been reached
                            dpkg: error processing package python-liblarch (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python-glade2:
 python-glade2 depends on python-gtk2 (= 2.24.0-4ubuntu1); however:
  Package python-gtk2 is not configured yet.

dpkg: error processing package python-glade2 (--configure):
 dependency problems - leaving unconfigured
Setting up python-dbus (1.2.0-3) ...
No apport report written because MaxReports has already been reached
                                                                    Remove stale byte-compiled files...
/var/lib/dpkg/info/python-dbus.postinst: 22: /var/lib/dpkg/info/python-dbus.postinst: pycompile: not found
dpkg: error processing package python-dbus (--configure):
 subprocess installed post-installation script returned error exit status 127
No apport report written because MaxReports has already been reached
                                                                    Setting up python-xdg (0.25-4) ...
/var/lib/dpkg/info/python-xdg.postinst: 6: /var/lib/dpkg/info/python-xdg.postinst: pycompile: not found
dpkg: error processing package python-xdg (--configure):
 subprocess installed post-installation script returned error exit status 127
No apport report written because MaxReports has already been reached
                                                                    Setting up python-six (1.10.0-3) ...
/var/lib/dpkg/info/python-six.postinst: 6: /var/lib/dpkg/info/python-six.postinst: pycompile: not found
dpkg: error processing package python-six (--configure):
 subprocess installed post-installation script returned error exit status 127
No apport report written because MaxReports has already been reached
                                                                    dpkg: dependency problems prevent configuration of python-configobj:
 python-configobj depends on python-six; however:
  Package python-six is not configured yet.

dpkg: error processing package python-configobj (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports has already been reached
                                                                    dpkg: dependency problems prevent configuration of gtg:
 gtg depends on python-gtk2 (>= 2.14); however:
  Package python-gtk2 is not configured yet.
 gtg depends on python-glade2; however:
  Package python-glade2 is not configured yet.
 gtg depends on python-dbus; however:
  Package python-dbus is not configured yet.
 gtg depends on python-xdg; however:
  Package python-xdg is not configured yet.
 gtg depends on python-configobj; however:
  Package python-configobj is not configured yet.
 gtg depends on python-liblarch (>= 2.1.0); however:
  Package python-liblarch is not configured yet.

dpkg: error processing package gtg (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports has already been reached
                                                                    Setting up python-gi (3.20.0-0ubuntu1) ...
/var/lib/dpkg/info/python-gi.postinst: 6: /var/lib/dpkg/info/python-gi.postinst: pycompile: not found
dpkg: error processing package python-gi (--configure):
 subprocess installed post-installation script returned error exit status 127
No apport report written because MaxReports has already been reached
                                                                    dpkg: dependency problems prevent configuration of ibus-pinyin:
 ibus-pinyin depends on python-gi; however:
  Package python-gi is not configured yet.
 ibus-pinyin depends on python-xdg; however:
  Package python-xdg is not configured yet.

dpkg: error processing package ibus-pinyin (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports has already been reached
                                                                    Setting up python-simplejson (3.8.1-1ubuntu2) ...
/var/lib/dpkg/info/python-simplejson.postinst: 6: /var/lib/dpkg/info/python-simplejson.postinst: pycompile: not found
dpkg: error processing package python-simplejson (--configure):
 subprocess installed post-installation script returned error exit status 127
No apport report written because MaxReports has already been reached
                                                                    Setting up python-wxversion (3.0.2.0+dfsg-1build1) ...
/var/lib/dpkg/info/python-wxversion.postinst: 6: /var/lib/dpkg/info/python-wxversion.postinst: pycompile: not found
No apport report written because MaxReports has already been reached
                                                                    dpkg: error processing package python-wxversion (--configure):
 subprocess installed post-installation script returned error exit status 127
dpkg: dependency problems prevent configuration of python-wxgtk3.0:
 python-wxgtk3.0 depends on python-wxversion; however:
  Package python-wxversion is not configured yet.

dpkg: error processing package python-wxgtk3.0 (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports has already been reached
                                                                    dpkg: dependency problems prevent configuration of compizconfig-settings-manager:
 compizconfig-settings-manager depends on python-gtk2; however:
  Package python-gtk2 is not configured yet.

dpkg: error processing package compizconfig-settings-manager (--configure):
 dependency problems - leaving unconfigured
No apport report written because MaxReports has already been reached
                                                                    Processing triggers for libc-bin (2.23-0ubuntu3) ...
Errors were encountered while processing:
 python-gobject-2
 python-cairo
 python-gtk2
 python-liblarch
 python-glade2
 python-dbus
 python-xdg
 python-six
 python-configobj
 gtg
 python-gi
 ibus-pinyin
 python-simplejson
 python-wxversion
 python-wxgtk3.0
 compizconfig-settings-manager
E: Sub-process /usr/bin/dpkg returned an error code (1)

Also: dpkg --verify python-minimal returns nothing

Zanna
  • 70,465
  • I have got the same error in this Question – anand mbs Jun 22 '16 at 03:04
  • It seems like your problem is not resolved... –  Jun 22 '16 at 03:07
  • I didnt say it's resolved. Just mentioned I have the issue so others can also rectify my issue too – anand mbs Jun 22 '16 at 03:07
  • 1
    The primary error seems to be pycompile: not found: is the python-minimal package correctly installed? Maybe try reinstalling it? – steeldriver Jun 22 '16 at 03:08
  • I did sudo apt-get install python-minimal and it returned python minimal is already the newest version. –  Jun 22 '16 at 03:11
  • There seems to be so many python package problems. Can I completely remove python and reinstall it? –  Jun 22 '16 at 03:12
  • I have tried a lot of things I can find, like sudo apt-get autoclean, autoremove or whatever but they never solve the problem... –  Jun 22 '16 at 03:14
  • @NancySchroepfer Consider updating your question with things that you have tried so that we can converge to a solution faster. – edwinksl Jun 22 '16 at 03:21
  • Don't try to remove python - it will likely break things worse. Please run dpkg --verify python-minimal and [edit] your question with the output. – steeldriver Jun 22 '16 at 11:44
  • I ran that and it returned nothing. –  Jun 22 '16 at 23:14
  • @NancySchroepfer, Could you add output of ls -l $(which pycompile); apt-cache policy python-minimal also you can try reinstall and see if it works sudo apt-get install --reinstall python-minimal – user.dz Jun 30 '16 at 17:51
  • @steeldriver, ls -l $(which pycompile) returned -rwxr-xr-x 1 root root 11894 Dec 9 2015 /usr/bin/pycompile, apt-cache policy python-minimal returned python-minimal: Installed: 2.7.11-1 Candidate: 2.7.11-1 Version table: *** 2.7.11-1 500 500 http://us.archive.ubuntu.com/ubuntu xenial/main amd64 Packages 100 /var/lib/dpkg/status –  Jul 05 '16 at 23:39
  • @steeldriver, when I did sudo apt-get install --reinstall python-minimal, I got "Processing triggers for libc-bin (2.23-0ubuntu3), does that mean it is now working? because it no longer returns the error. –  Jul 05 '16 at 23:47
  • 1

1 Answers1

3

Multiple packages are trying to run the pycompile program during their execution. dpkg-query -S */pycompile tells us that pycompile is a program that is part of the python-minimal package. (In newer Ubuntu releases it would likely be python3-minimal because all the mentioned depending packages are now based on Python 3. Run the previously stated dpkg-query command to be sure. Once confirmed, replace all occurrences below accordingly.)

Apt doesn't complain about the missing package, but it seems the program is missing nonetheless. You can restore the corrupted package with:

sudo apt-get install -f --reinstall python-minimal

If Apt complains that it cannot re-install that package (e. g. because half-installed packages), we need to go deeper and download and install the package manually:

cd /tmp
apt-get download python-minimal
sudo dpkg -i python-minimal_*.deb
sudo apt-get install -f
David Foerster
  • 36,264
  • 56
  • 94
  • 147
  • @archisman-panigrahi I rolled back your edit because I think it is more confusing than helpful to instruct readers to fix a “newer” package than the one that was broken according to the data in the question. – David Foerster Feb 03 '22 at 14:13
  • Sure. I edited because someone (in another question) followed this answer in Ubuntu 20.04, but it did not work because it has python3 (I can't find that question right now because this issue is very common, and shows up in Ask Ubuntu almost every day, as a lot of new users end up messing up with python). At least, please add a note that in recent versions of Ubuntu, the package is python3-minimal. – Archisman Panigrahi Feb 03 '22 at 14:39
  • 1
    @ArchismanPanigrahi Thanks for the explanation! In that case I agree that the most beneficial or at least “least harmful” course of action is to add a note to explain the possibly diverging package names and how to handle them (like I just did), – David Foerster Feb 03 '22 at 14:50