8
You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
 libpython3.6 : Depends: libpython3.6-stdlib (= 3.6.5-5~16.04.york1) but 3.6.5-5~16.04.york0 is installed
 libpython3.6-dev : Depends: libpython3.6-stdlib (= 3.6.5-5~16.04.york1) but 3.6.5-5~16.04.york0 is installed
 libpython3.6-stdlib : Depends: libpython3.6-minimal (= 3.6.5-5~16.04.york0) but 3.6.5-5~16.04.york1 is installed
 python3.6 : Depends: libpython3.6-stdlib (= 3.6.5-5~16.04.york1) but 3.6.5-5~16.04.york0 is installed
E: Unmet dependencies. Try using -f.

I had installed using PPA JonathanF in Ubuntu 16.04, and it was working fine until I encountered this issue today.

TI tried and got the below error:

$ sudo apt-get upgrade -f
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
Calculating upgrade... Done
The following packages will be upgraded:
  libpython3.6-stdlib
1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
5 not fully installed or removed.
Need to get 0 B/1,989 kB of archives.
After this operation, 1,393 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
(Reading database ... 231399 files and directories currently installed.)
Preparing to unpack .../libpython3.6-stdlib_3.6.5-5~16.04.york1_amd64.deb ...
Unpacking libpython3.6-stdlib:amd64 (3.6.5-5~16.04.york1) over (3.6.5-5~16.04.york0) ...
dpkg: error processing archive /var/cache/apt/archives/libpython3.6-stdlib_3.6.5-5~16.04.york1_amd64.deb (--unpack):
 trying to overwrite '/usr/lib/python3.6/lib2to3/refactor.py', which is also in package python3-lib2to3 3.6.5-3~16.04.york0.2
dpkg-deb: error: subprocess paste was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/libpython3.6-stdlib_3.6.5-5~16.04.york1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
karel
  • 122,292
  • 133
  • 301
  • 332

3 Answers3

20

This answer worked for me =)

sudo dpkg --install --force all /var/cache/apt/archives/libpython3.6-stdlib_3.6.5-5~16.04.york1_amd64.deb

From: https://stackoverflow.com/a/50408787/1503549

NB: Remember to perform the following afterwards:

sudo apt install -f

Replace "apt" with "apt-get"/"aptitude", or whatever apt-derivative you're using.

x10an14
  • 300
1

Looks like your packages are partially out of date. Updating the package list and then upgrading installed packages with available upgrades should fix the broken dependencies:

sudo apt-get update
sudo apt-get upgrade -f

If not, could you please edit your question to include the complete, verbatim output of the above commands? Thanks.

David Foerster
  • 36,890
  • 56
  • 97
  • 151
0

You might have python 3.6 being installed from multiple places which is causing the issue (http://ppa.launchpad.net/jonathonf/python-3.6/ubuntu for example).

If this is the case, you need to comment or remove it from /etc/apt/sources, do an apt update, then try apt-get -f install again.