8

Maybe somebody can help me through this hell:

It all began as I encountered this error: https://askubuntu.com/a/1034266/570817

and I tried to somehow remove the ppa:jonathonf/python-3.6 installation but I did it wrong in the first place and just deleted the python3 files in /usr/bin/python3*

Then I went further with ongoing speed straight to hell by try-and-erroring different hints on other similar posts, where from some of them I will now post the complete output:

First I sudo apt-get remove python3...

Then I get the following outputs:

sudo dpkg --configure -a
dpkg: dependency problems prevent configuration of python3:
 python3 depends on dh-python; however:
  Package dh-python is not configured yet.

dpkg: error processing package python3 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of update-notifier-common:
 update-notifier-common depends on python3:any; however:
  Package python3 is not configured yet.

dpkg: error processing package update-notifier-common (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python3-update-manager:
 python3-update-manager depends on python3:any (>= 3.3.2-2~); however:
  Package python3 is not configured yet.

dpkg: error processing package python3-update-manager (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of apport-gtk:
 apport-gtk depends on python3; however:
  Package python3 is not configured yet.

dpkg: error processing package apport-gtk (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of apturl:
 apturl depends on python3:any (>= 3.3.2-2~); however:
  Package python3 is not configured yet.

dpkg: error processing package apturl (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of ubuntu-release-upgrader-core:
 ubuntu-release-upgrader-core depends on python3:any (>= 3.2~); however:
  Package python3 is not configured yet.

dpkg: error processing package ubuntu-release-upgrader-core (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of apturl-common:
 apturl-common depends on python3:any (>= 3.3.2-2~); however:
  Package python3 is not configured yet.
 apturl-common depends on python3-update-manager; however:
  Package python3-update-manager is not configured yet.

dpkg: error processing package apturl-common (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of update-notifier:
 update-notifier depends on update-notifier-common (= 3.168.9); however:
  Package update-notifier-common is not configured yet.

dpkg: error processing package update-notifier (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of aptdaemon:
 aptdaemon depends on python3; however:
  Package python3 is not configured yet.
 aptdaemon depends on python3:any (>= 3.2~); however:
  Package python3 is not configured yet.

dpkg: error processing package aptdaemon (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python3-requests:
 python3-requests depends on python3:any (>= 3.3.2-2~); however:
  Package python3 is not configured yet.

dpkg: error processing package python3-requests (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of apport:
 apport depends on python3; however:
  Package python3 is not configured yet.

dpkg: error processing package apport (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of update-manager:
 update-manager depends on python3:any (>= 3.3.2-2~); however:
  Package python3 is not configured yet.
 update-manager depends on update-manager-core (= 1:16.04.13); however:
  Version of update-manager-core on system is 1:16.04.15.
 update-manager depends on update-notifier; however:
  Package update-notifier is not configured yet.

dpkg: error processing package update-manager (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of python3-urllib3:
 python3-urllib3 depends on python3:any (>= 3.3.2-2~); however:
  Package python3 is not configured yet.

dpkg: error processing package python3-urllib3 (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent processing triggers for gnome-menus:
 gnome-menus depends on python3:any (>= 3.1~); however:
  Package python3 is not configured yet.

dpkg: error processing package gnome-menus (--configure):
 dependency problems - leaving triggers unprocessed
dpkg: dependency problems prevent configuration of python3-distupgrade:
 python3-distupgrade depends on python3:any (>= 3.3.2-2~); however:
  Package python3 is not configured yet.
 python3-distupgrade depends on python3-update-manager (>= 1:0.196.2~); however:
  Package python3-update-manager is not configured yet.

dpkg: error processing package python3-distupgrade (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of ubuntu-release-upgrader-gtk:
 ubuntu-release-upgrader-gtk depends on ubuntu-release-upgrader-core (= 1:16.04.25); however:
  Package ubuntu-release-upgrader-core is not configured yet.
 ubuntu-release-upgrader-gtk depends on update-manager; however:
  Package update-manager is not configured yet.
 ubuntu-release-upgrader-gtk depends on python3-distupgrade (= 1:16.04.25); however:
  Package python3-distupgrade is not configured yet.

dpkg: error processing package ubuntu-release-upgrader-gtk (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of update-manager-core:
 update-manager-core depends on python3:any (>= 3.2~); however:
  Package python3 is not configured yet.
 update-manager-core depends on python3-update-manager (= 1:16.04.15); however:
  Package python3-update-manager is not configured yet.
 update-manager-core depends on ubuntu-release-upgrader-core; however:
  Package ubuntu-release-upgrader-core is not configured yet.

dpkg: error processing package update-manager-core (--configure):
 dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of gconf2:
 gconf2 depends on python3:any; however:
  Package python3 is not configured yet.

dpkg: error processing package gconf2 (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 python3
 update-notifier-common
 python3-update-manager
 apport-gtk
 apturl
 ubuntu-release-upgrader-core
 apturl-common
 update-notifier
 aptdaemon
 python3-requests
 apport
 update-manager
 python3-urllib3
 gnome-menus
 python3-distupgrade
 ubuntu-release-upgrader-gtk
 update-manager-core
 gconf2

sudo apt-get -f install:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
  appstream compiz-core compiz-plugins-default gnome-software-common guile-2.0-libs libapparmor-perl libappstream3 libcompizconfig0 libdecoration0 libjemalloc1
  libmetacity-private3a libopencolorio1v5 libopenimageio1.6 libsnapd-glib1 libspnav0 libyaml-cpp0.3v5 metacity-common python-backports.ssl-match-hostname
  python-cached-property python-docker python-dockerpty python-docopt python-funcsigs python-functools32 python-jsonschema python-mock python-pbr python-texttable
  python-websocket python-yaml run-one snapd-login-service tmux
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  apturl apturl-common python3-requests update-manager
Suggested packages:
  python3-ndg-httpsclient python3-openssl
The following NEW packages will be installed:
  python3-requests
The following packages will be upgraded:
  apturl apturl-common update-manager
3 upgraded, 1 newly installed, 0 to remove and 176 not upgraded.
21 not fully installed or removed.
Need to get 55,8 kB/619 kB of archives.
After this operation, 254 kB of additional disk space will be used.
Do you want to continue? [Y/n] 
Get:1 http://at.archive.ubuntu.com/ubuntu xenial-updates/main amd64 python3-requests all 2.9.1-3ubuntu0.1 [55,8 kB]
Fetched 55,8 kB in 0s (537 kB/s)           
dpkg: warning: files list file for package 'python3.5' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-ipy' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-gdbm-dbg:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-speechd' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-xlsxwriter' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-pycurl' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-pil:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-cups' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3.6' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-apt' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-dbus' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-pyatspi' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-plainbox' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-lxml' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-brlapi' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-mako' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-commandnotfound' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-padme' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-xdg' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-six' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3.5-venv' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-pyparsing' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3.6-minimal' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-dev' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-guacamole' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-newt' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-aptdaemon.gtk3widgets' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-wheel' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-gi-cairo' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-pkg-resources' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-gi' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-bs4' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-apport' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-markupsafe' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3.5-minimal' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-defer' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-problem-report' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-reportlab' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-pyasn1' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-uno' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-pexpect' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-chardet' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-aptdaemon' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-systemd' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-jinja2' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-html5lib' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-minimal' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-pip' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-cupshelpers' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-gdbm:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-software-properties' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-reportlab-accel:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-cairo' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-setuptools' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-aptdaemon.pkcompat' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3.5-dev' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-ptyprocess' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-checkbox-support' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-debian' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-renderpm:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-xkit' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-venv' missing; assuming package has no files currently installed
(Reading database ... 429592 files and directories currently installed.)
Preparing to unpack .../update-manager_1%3a16.04.15_all.deb ...
/var/lib/dpkg/info/update-manager.prerm: 6: /var/lib/dpkg/info/update-manager.prerm: py3clean: not found
dpkg: warning: subprocess old pre-removal script returned error exit status 127
dpkg: trying script from the new package instead ...
/var/lib/dpkg/tmp.ci/prerm: 6: /var/lib/dpkg/tmp.ci/prerm: py3clean: not found
dpkg: error processing archive /var/cache/apt/archives/update-manager_1%3a16.04.15_all.deb (--unpack):
 subprocess new pre-removal script returned error exit status 127
/var/lib/dpkg/info/update-manager.postinst: 6: /var/lib/dpkg/info/update-manager.postinst: py3compile: not found
dpkg: error while cleaning up:
 subprocess installed post-installation script returned error exit status 127
Preparing to unpack .../apturl_0.5.2ubuntu11.2_amd64.deb ...
/var/lib/dpkg/info/apturl.prerm: 6: /var/lib/dpkg/info/apturl.prerm: py3clean: not found
dpkg: warning: subprocess old pre-removal script returned error exit status 127
dpkg: trying script from the new package instead ...
/var/lib/dpkg/tmp.ci/prerm: 6: /var/lib/dpkg/tmp.ci/prerm: py3clean: not found
dpkg: error processing archive /var/cache/apt/archives/apturl_0.5.2ubuntu11.2_amd64.deb (--unpack):
 subprocess new pre-removal script returned error exit status 127
/var/lib/dpkg/info/apturl.postinst: 6: /var/lib/dpkg/info/apturl.postinst: py3compile: not found
dpkg: error while cleaning up:
 subprocess installed post-installation script returned error exit status 127
Preparing to unpack .../apturl-common_0.5.2ubuntu11.2_amd64.deb ...
/var/lib/dpkg/info/apturl-common.prerm: 6: /var/lib/dpkg/info/apturl-common.prerm: py3clean: not found
dpkg: warning: subprocess old pre-removal script returned error exit status 127
dpkg: trying script from the new package instead ...
/var/lib/dpkg/tmp.ci/prerm: 6: /var/lib/dpkg/tmp.ci/prerm: py3clean: not found
dpkg: error processing archive /var/cache/apt/archives/apturl-common_0.5.2ubuntu11.2_amd64.deb (--unpack):
 subprocess new pre-removal script returned error exit status 127
/var/lib/dpkg/info/apturl-common.postinst: 27: /var/lib/dpkg/info/apturl-common.postinst: py3compile: not found
dpkg: error while cleaning up:
 subprocess installed post-installation script returned error exit status 127
Selecting previously unselected package python3-requests.
Preparing to unpack .../python3-requests_2.9.1-3ubuntu0.1_all.deb ...
Unpacking python3-requests (2.9.1-3ubuntu0.1) ...
Errors were encountered while processing:
 /var/cache/apt/archives/update-manager_1%3a16.04.15_all.deb
 /var/cache/apt/archives/apturl_0.5.2ubuntu11.2_amd64.deb
 /var/cache/apt/archives/apturl-common_0.5.2ubuntu11.2_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

sudo apt-get install python3:

Reading package lists... Done
Building dependency tree       
Reading state information... Done
python3 is already the newest version (3.5.1-3).
python3 set to manually installed.
The following packages were automatically installed and are no longer required:
  appstream compiz-core compiz-plugins-default gnome-software-common guile-2.0-libs libapparmor-perl libappstream3 libcompizconfig0 libdecoration0 libjemalloc1
  libmetacity-private3a libopencolorio1v5 libopenimageio1.6 libsnapd-glib1 libspnav0 libyaml-cpp0.3v5 metacity-common python-backports.ssl-match-hostname
  python-cached-property python-docker python-dockerpty python-docopt python-funcsigs python-functools32 python-jsonschema python-mock python-pbr python-texttable
  python-websocket python-yaml run-one snapd-login-service tmux
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  apturl apturl-common update-manager
The following packages will be upgraded:
  apturl apturl-common update-manager
3 upgraded, 0 newly installed, 0 to remove and 176 not upgraded.
22 not fully installed or removed.
Need to get 0 B/563 kB of archives.
After this operation, 1.024 B of additional disk space will be used.
Do you want to continue? [Y/n] 
dpkg: warning: files list file for package 'python3.5' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-ipy' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-gdbm-dbg:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-speechd' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-xlsxwriter' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-pycurl' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-pil:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-cups' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3.6' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-apt' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-dbus' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-pyatspi' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-plainbox' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-lxml' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-brlapi' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-mako' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-commandnotfound' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-padme' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-xdg' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-six' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3.5-venv' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-pyparsing' missing; assuming package has no files currently installed
...
dpkg: warning: files list file for package 'python3-setuptools' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-aptdaemon.pkcompat' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3.5-dev' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-ptyprocess' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-checkbox-support' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-debian' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-renderpm:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-xkit' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python3-venv' missing; assuming package has no files currently installed
(Reading database ... 429618 files and directories currently installed.)
Preparing to unpack .../update-manager_1%3a16.04.15_all.deb ...
/var/lib/dpkg/info/update-manager.prerm: 6: /var/lib/dpkg/info/update-manager.prerm: py3clean: not found
dpkg: warning: subprocess old pre-removal script returned error exit status 127
dpkg: trying script from the new package instead ...
/var/lib/dpkg/tmp.ci/prerm: 6: /var/lib/dpkg/tmp.ci/prerm: py3clean: not found
dpkg: error processing archive /var/cache/apt/archives/update-manager_1%3a16.04.15_all.deb (--unpack):
 subprocess new pre-removal script returned error exit status 127
/var/lib/dpkg/info/update-manager.postinst: 6: /var/lib/dpkg/info/update-manager.postinst: py3compile: not found
dpkg: error while cleaning up:
 subprocess installed post-installation script returned error exit status 127
Preparing to unpack .../apturl_0.5.2ubuntu11.2_amd64.deb ...
/var/lib/dpkg/info/apturl.prerm: 6: /var/lib/dpkg/info/apturl.prerm: py3clean: not found
dpkg: warning: subprocess old pre-removal script returned error exit status 127
dpkg: trying script from the new package instead ...
/var/lib/dpkg/tmp.ci/prerm: 6: /var/lib/dpkg/tmp.ci/prerm: py3clean: not found
dpkg: error processing archive /var/cache/apt/archives/apturl_0.5.2ubuntu11.2_amd64.deb (--unpack):
 subprocess new pre-removal script returned error exit status 127
/var/lib/dpkg/info/apturl.postinst: 6: /var/lib/dpkg/info/apturl.postinst: py3compile: not found
dpkg: error while cleaning up:
 subprocess installed post-installation script returned error exit status 127
Preparing to unpack .../apturl-common_0.5.2ubuntu11.2_amd64.deb ...
/var/lib/dpkg/info/apturl-common.prerm: 6: /var/lib/dpkg/info/apturl-common.prerm: py3clean: not found
dpkg: warning: subprocess old pre-removal script returned error exit status 127
dpkg: trying script from the new package instead ...
/var/lib/dpkg/tmp.ci/prerm: 6: /var/lib/dpkg/tmp.ci/prerm: py3clean: not found
dpkg: error processing archive /var/cache/apt/archives/apturl-common_0.5.2ubuntu11.2_amd64.deb (--unpack):
 subprocess new pre-removal script returned error exit status 127
/var/lib/dpkg/info/apturl-common.postinst: 27: /var/lib/dpkg/info/apturl-common.postinst: py3compile: not found
dpkg: error while cleaning up:
 subprocess installed post-installation script returned error exit status 127
Errors were encountered while processing:
 /var/cache/apt/archives/update-manager_1%3a16.04.15_all.deb
 /var/cache/apt/archives/apturl_0.5.2ubuntu11.2_amd64.deb
 /var/cache/apt/archives/apturl-common_0.5.2ubuntu11.2_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

How can I fix my broken python3 installation on my system, when apt-get and dpkg are depending on it??

Thanks in advance!

  • https://stackoverflow.com/questions/30962402/dpkg-error-pycompile-not-found This answer helped me, hope it resolves someones problem. – harsh grover May 26 '19 at 13:38

2 Answers2

10

We generally recommend against changing your installed version of Python3 for precisely this reason.

When folks want to use multiple versions or newer versions of Python, we recommend isolation methods (like VMs, containers, python(3)-virtualenv, or chroots) to prevent damage to your system. There are other methods not in the Ubuntu repositories -- we don't provide support for those.

It's likely possible to fix your system, but may not be worthwhile. Many dependencies may be missing. dpkg does NOT depend upon Python3, but apt definitely does. The basic strategy is to use dpkg to reinstall the missing packages you need for apt.

Visit http://packages.ubuntu.com, and download the python-minimal and python3-minimal and apt packages, then install those packages using dpkg. It may take a few iterations, as dpkg complains about other missing dependencies that you must download and install in the correct order.

Generally, most users who have broken or missing Python find it faster and easier to simply backup their data and do a clean-install.

user535733
  • 62,253
  • Thanks for the clarification. Went for the latter and bought a hdd, backupped my data and will install Ubuntu 18.04 then... I got that going for me. – ElectRocnic Nov 14 '18 at 20:46
  • 1
    in a similar setup i used python3-minimal and python3 in respective versions - and was able to re-vitalize the system with dpkg. afterwards a bunch of packages for the GUI were missing such as "unity", "gnome-terminal" and "firefox". - the whole story has sort of a hen-egg problem and feels like a bootstrap story with a complexity similar to this one: https://en.wikipedia.org/wiki/M%C3%BCnchhausen_trilemma – Alexander Stohr Feb 11 '21 at 13:19
  • in my case i just switched to python3.6 by setting a symlink. with a bit of mis-fortune i killed the python3.5 binary an the "--reinstall" of the package in question already choked... – Alexander Stohr Feb 11 '21 at 13:25
0

I am late but want to add my answer as there is only 2 solutions.

  1. Reinstall ubunut
  2. Do the below.

It happend to my i tried to remove some files and mistakenly i remove /usr/bin/pythonxx almost everything of python. I could not install - remove anything.

SOLUTION Install python on any other machine i.e VPS apt install python python3 python-all python-minimal python3-minimal

Once you have pythone installed on your VPS or another PC.

cd /var/lib zip -r fix.zip dpkg

Now copy this file(from VPS download) to your system at /var/lib unzip fiz.zip Press A to overwrite ALL

Now on your machine apt install python3-all python3-minimal --reinstall apt autoremove

FIXED