Can't Install or remove anything on Ubuntu 16.04 because py3clean and py3compile not found
I am unable to install or upgrade anything on Ubuntu 16.04.I am missing package python3-software-properties and can't install it anyhow . I have posted the various tracebacks. I tried installing these packages and got these errors.
sarfraz@sarfraz:~$ sudo apt-get install --reinstall dpkg
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
language-selector-common language-selector-gnome python3-distupgrade
python3-software-properties software-properties-common software- properties-gtk
Recommended packages:
unattended-upgrades
The following packages will be upgraded:language-selector-common
language-selector-gnome python3-distupgrade python3-software-
properties software-properties-common software-properties-gtk
6 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 30 not upgraded.
141 not fully installed or removed.
Need to get 2,083 kB/2,496 kB of archives.
After this operation, 1,024 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://in.archive.ubuntu.com/ubuntu xenial-updates/main amd64 dpkg amd64 1.18.4ubuntu1.1 [2,083 kB]
Fetched 2,083 kB in 3s (617 kB/s)
(Reading database ... 220260 files and directories currently installed.)
Preparing to unpack .../language-selector-gnome_0.165.4_all.deb ...
/var/lib/dpkg/info/language-selector-gnome.prerm: 6: /var/lib/dpkg/info/language-selector-gnome.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/language-selector-gnome_0.165.4_all.deb (--unpack):
subprocess new pre-removal script returned error exit status 127
/var/lib/dpkg/info/language-selector-gnome.postinst: 6: /var/lib/dpkg/info/language-selector-gnome.postinst: py3compile: not found
dpkg: error while cleaning up:
subprocess installed post-installation script returned error exit status 127
Preparing to unpack .../dpkg_1.18.4ubuntu1.1_amd64.deb ...
Unpacking dpkg (1.18.4ubuntu1.1) over (1.18.4ubuntu1.1) ...
Errors were encountered while processing:
/var/cache/apt/archives/language-selector-gnome_0.165.4_all.deb
sarfraz@sarfraz:~$ sudo apt-get install python3-minimal
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-minimal is already the newest version (3.5.1-3).
The following additional packages will be installed:
language-selector-common language-selector-gnome python3-distupgrade
python3-software-properties software-properties-common software- properties-gtk
Recommended packages:
unattended-upgrades
The following packages will be upgraded:
language-selector-common language-selector-gnome python3-distupgrade python3-software-properties software-properties-common software- properties-gtk
6 upgraded, 0 newly installed, 0 to remove and 30 not upgraded.
141 not fully installed or removed.
Need to get 0 B/413 kB of archives.
After this operation, 1,024 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
(Reading database ... 220260 files and directories currently installed.)
Preparing to unpack .../language-selector-gnome_0.165.4_all.deb ...
/var/lib/dpkg/info/language-selector-gnome.prerm: 6: /var/lib/dpkg/info/language-selector-gnome.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/language- selector-gnome_0.165.4_all.deb (--unpack):
subprocess new pre-removal script returned error exit status 127
/var/lib/dpkg/info/language-selector-gnome.postinst: 6: /var/lib/dpkg/info/language-selector-gnome.postinst: py3compile: not found
dpkg: error while cleaning up:
subprocess installed post-installation script returned error exit status 127
Preparing to unpack .../language-selector-common_0.165.4_all.deb ...
/var/lib/dpkg/info/language-selector-common.prerm: 21: /var/lib/dpkg/info/language-selector-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: 21: /var/lib/dpkg/tmp.ci/prerm: py3clean: not found
dpkg: error processing archive /var/cache/apt/archives/language- selector-common_0.165.4_all.deb (--unpack):
subprocess new pre-removal script returned error exit status 127
/var/lib/dpkg/info/language-selector-common.postinst: 23: /var/lib/dpkg/info/language-selector-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/language-selector-gnome_0.165.4_all.deb
/var/cache/apt/archives/language-selector-common_0.165.4_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
sarfraz@sarfraz:~$ sudo apt-get install libssl-dev openssl
Reading package lists... Done
Building dependency tree
Reading state information... Done
libssl-dev is already the newest version (1.0.2g-1ubuntu4.1).
openssl is already the newest version (1.0.2g-1ubuntu4.1).
The following additional packages will be installed:
language-selector-common language-selector-gnome python3-distupgrade python3-software-properties software-properties-common software- properties-gtk
Recommended packages:
unattended-upgrades
The following packages will be upgraded:
language-selector-common language-selector-gnome python3-distupgrade python3-software-properties software-properties-common software- properties-gtk
6 upgraded, 0 newly installed, 0 to remove and 30 not upgraded.
141 not fully installed or removed.
Need to get 0 B/413 kB of archives.
After this operation, 1,024 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
(Reading database ... 220260 files and directories currently installed.)
Preparing to unpack .../language-selector-gnome_0.165.4_all.deb ...
/var/lib/dpkg/info/language-selector-gnome.prerm: 6: /var/lib/dpkg/info/language-selector-gnome.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/language- selector-gnome_0.165.4_all.deb (--unpack):
subprocess new pre-removal script returned error exit status 127
/var/lib/dpkg/info/language-selector-gnome.postinst: 6: /var/lib/dpkg/info/language-selector-gnome.postinst: py3compile: not found
dpkg: error while cleaning up:
subprocess installed post-installation script returned error exit status 127
Preparing to unpack .../language-selector-common_0.165.4_all.deb ...
/var/lib/dpkg/info/language-selector-common.prerm: 21: /var/lib/dpkg/info/language-selector-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: 21: /var/lib/dpkg/tmp.ci/prerm: py3clean: not found
dpkg: error processing archive /var/cache/apt/archives/language-selector-common_0.165.4_all.deb (--unpack):
subprocess new pre-removal script returned error exit status 127
/var/lib/dpkg/info/language-selector-common.postinst: 23: /var/lib/dpkg/info/language-selector-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/language-selector-gnome_0.165.4_all.deb
/var/cache/apt/archives/language-selector-common_0.165.4_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
sarfraz@sarfraz:~$ sudo apt-get update && sudo apt-get dist-upgrade -y
Ign:1 http://dl.google.com/linux/chrome/deb stable InRelease
Hit:2 http://dl.google.com/linux/chrome/deb stable Release
Hit:4 http://ppa.launchpad.net/mystic-mirage/pycharm/ubuntu xenial InRelease
Hit:5 http://ppa.launchpad.net/webupd8team/sublime-text-3/ubuntu xenial InRelease
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: The package python3-software-properties needs to be reinstalled, but I can't find an archive for it.
sarfraz@sarfraz:~$ sudo apt-get install --reinstall python-software-properties
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: The package python3-software-properties needs to be reinstalled, but I can't find an archive for it.
sarfraz@sarfraz:~$ sudo apt-get install --reinstall python-software-properties
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: The package python3-software-properties needs to be reinstalled, but I can't find an archive for it.
sarfraz@sarfraz:~$ sudo apt-get install software-properties-common
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: The package python3-software-properties needs to be reinstalled, but I can't find an archive for it.
sarfraz@sarfraz:~$ sudo apt-get install --reinstall python3-software-properties
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: The package python3-software-properties needs to be reinstalled, but I can't find an archive for it.
sarfraz@sarfraz:~$ sudo dpkg -i Downloads/python3-software-properties_0.92.36_all.deb
(Reading database ... 220260 files and directories currently installed.)
Preparing to unpack .../python3-software-properties_0.92.36_all.deb ...
/var/lib/dpkg/info/python3-software-properties.prerm: 6: /var/lib/dpkg/info/python3-software-properties.prerm: py3clean: not found
dpkg: error processing archive Downloads/python3-software- properties_0.92.36_all.deb (--install):
subprocess installed pre-removal script returned error exit status 127
/var/lib/dpkg/info/python3-software-properties.postinst: 6: /var/lib/dpkg/info/python3-software-properties.postinst: py3compile: not found
dpkg: error while cleaning up:
subprocess installed post-installation script returned error exit status 127
Errors were encountered while processing:
Downloads/python3-software-properties_0.92.36_all.deb
sarfraz@sarfraz:~$ sudo apt-get update
Ign:1 http://dl.google.com/linux/chrome/deb stable InRelease
Hit:2 http://dl.google.com/linux/chrome/deb stable Release
Hit:4 http://ppa.launchpad.net/mystic-mirage/pycharm/ubuntu xenial InRelease
Hit:5 http://ppa.launchpad.net/webupd8team/sublime-text-3/ubuntu xenial InRelease
Reading package lists... Done
sarfraz@sarfraz:~$ sudo apt-get install --reinstall python3
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: The package python3-software-properties needs to be reinstalled, but I can't find an archive for it.
Help will be appreciated.
Solution 1:
Try running the following command:
apt-get -f install
to correct a system with broken dependencies in place.
Try also: dpkg --configure -a
.
If above won't help, try reinstalling your core Python installation as py3compile
file is part of python3-minimal
package, so if you still got the problem, try reinstalling that package. If you can't reinstall using apt-get
, try to download .pkg
file from kernel.org and install manually (python3-minimal*). E.g.
dpkg -i python3-minimal_*.deb
Also make sure that py3compile
is accessible based on your current PATH
variable.
Solution 2:
I know this is an old thread, but I was able to resolve my broken Python3 system installation with sudo apt install python3-minimal python3 --reinstall