I recently installed Python3.8 and everything worked fine as far as using various versions of Python successfully in the terminal. After several days I called sudo apt update
, which worked just fine, but when I did sudo apt upgrade
I received the error message below. I tried to do sudo apt --fix-broken install
and a sub-process returned an error code.
When i tried sudo apt upgrade
Output
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
dh-python : Depends: python3-distutils but it is not installed
python3-dev : Depends: python3-distutils (>= 3.6.7-1~) but it is not installed
python3-pip : Depends: python3-distutils but it is not installed
python3-setuptools : Depends: python3-distutils but it is not installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
When i tried sudo apt --fix-broken install
Output
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:
libllvm7 libllvm8 libllvm8:i386 libpython3.7-minimal libpython3.7-stdlib
python3.7-minimal
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
python3-distutils python3-lib2to3
The following NEW packages will be installed:
python3-distutils python3-lib2to3
0 upgraded, 2 newly installed, 0 to remove and 122 not upgraded.
10 not fully installed or removed.
Need to get 0 B/222 kB of archives.
After this operation, 3,143 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 201984 files and directories currently installed.)
Preparing to unpack .../python3-lib2to3_3.6.9-1~18.04_all.deb ...
Unpacking python3-lib2to3 (3.6.9-1~18.04) ...
dpkg: error processing archive /var/cache/apt/archives/python3-lib2to3_3.6.9-1~18.04_all.deb (--unpack):
trying to overwrite '/usr/lib/python3.8/lib2to3/Grammar.txt', which is also in package python3.8-lib2to3 3.8.0-1+bionic2
Preparing to unpack .../python3-distutils_3.6.9-1~18.04_all.deb ...
Unpacking python3-distutils (3.6.9-1~18.04) ...
dpkg: error processing archive /var/cache/apt/archives/python3-distutils_3.6.9-1~18.04_all.deb (--unpack):
trying to overwrite '/usr/lib/python3.8/distutils/README', which is also in package python3.8-distutils 3.8.0-1+bionic2
Errors were encountered while processing:
/var/cache/apt/archives/python3-lib2to3_3.6.9-1~18.04_all.deb
/var/cache/apt/archives/python3-distutils_3.6.9-1~18.04_all.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
I also tried to do this sudo apt --fix-broken install python3-distutils
Output
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
python3-distutils : Depends: python3-lib2to3 (>= 3.6.4) but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).```
I also tried sudo apt --fix-broken install python3-lib2to3
Output
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
dh-python : Depends: python3-distutils but it is not going to be installed
python3-dev : Depends: python3-distutils (>= 3.6.7-1~) but it is not going to be installed
python3-pip : Depends: python3-distutils but it is not going to be installed
python3-setuptools : Depends: python3-distutils but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
Thanks for any help that can be provided!
Update
when I tried to do sudo apt install aptitude
Output
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
aptitude : Depends: aptitude-common (= 0.8.10-6ubuntu1) but it is not going to be installed
Depends: libcwidget3v5 but it is not going to be installed
dh-python : Depends: python3-distutils but it is not going to be installed
python3-dev : Depends: python3-distutils (>= 3.6.7-1~) but it is not going to be installed
python3-pip : Depends: python3-distutils but it is not going to be installed
python3-setuptools : Depends: python3-distutils but it is not going to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
sudo apt update -y sudo apt clean sudo apt autoremove
and thensudo apt --fix-broken install
– bhordupur Apr 14 '20 at 18:46Unpacking python3-lib2to3 (3.6.9-1~18.04) ... dpkg: error processing archive /var/cache/apt/archives/python3-lib2to3_3.6.9-1~18.04_all.deb (--unpack): trying to overwrite '/usr/lib/python3.8/lib2to3/Grammar.txt', which is also in package python3.8-lib2to3 3.8.0-1+bionic2
. Pick one source, delete the other source, and uninstall ALL packages from the deleted source. – user535733 Apr 14 '20 at 21:42cat /etc/apt/sources.list
– Raffa Apr 14 '20 at 23:35sudo dpkg -i --force-overwrite "/var/cache/apt/archives/python3-lib2to3...deb"
did the trick, as suggested https://ubuntuforums.org/showthread.php?t=2397244&p=13787159#post13787159. Obviously, first do als /var/cache/apt/archives/
to see which filename it has and place it in the command. This has worked with all failed packages which saidwhich is also in package
. – Fusseldieb Nov 30 '21 at 14:49