0

I'm attempting to install the python3.9-dev package from the deadsnakes ppa on an Ubuntu 18 system in order to build a python package from source, but there appears to be a conflict between two of the dependencies. The most relevant lines appear to be:

dpkg: error processing archive /tmp/apt-dpkg-install-RMgxYd/2-libpython3.9-stdlib_3.9.13-1+bionic1_amd64.deb (--unpack):
 trying to overwrite '/usr/lib/python3.9/_sysconfigdata__linux_x86_64-linux-gnu.py', which is also in package libpython3.9-minimal:amd64 3.9.6-1+bionic1
dpkg: error processing archive /tmp/apt-dpkg-install-RMgxYd/4-libpython3.9-minimal_3.9.13-1+bionic1_amd64.deb (--unpack):
 trying to overwrite '/usr/lib/python3.9/typing.py', which is also in package libpython3.9-stdlib:amd64 3.9.6-1+bionic1

Here's the entire output for context:

$ sudo apt install python3.9-dev 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libpython3.9 libpython3.9-dev libpython3.9-minimal libpython3.9-stdlib
  python3.9 python3.9-minimal python3.9-venv
The following NEW packages will be installed:
  libpython3.9 libpython3.9-dev python3.9-dev
The following packages will be upgraded:
  libpython3.9-minimal libpython3.9-stdlib python3.9 python3.9-minimal
  python3.9-venv
5 upgraded, 3 newly installed, 0 to remove and 334 not upgraded.
Need to get 52.8 MB/60.5 MB of archives.
After this operation, 79.4 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu bionic/main amd64 libpython3.9 amd64 3.9.13-1+bionic1 [1,751 kB]
Get:2 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu bionic/main amd64 libpython3.9-dev amd64 3.9.13-1+bionic1 [50.6 MB]
Get:3 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu bionic/main amd64 python3.9-dev amd64 3.9.13-1+bionic1 [501 kB]
Fetched 52.8 MB in 40s (1,335 kB/s)                                            
(Reading database ... 184010 files and directories currently installed.)
Preparing to unpack .../0-python3.9-venv_3.9.13-1+bionic1_amd64.deb ...
Unpacking python3.9-venv (3.9.13-1+bionic1) over (3.9.6-1+bionic1) ...
Preparing to unpack .../1-python3.9_3.9.13-1+bionic1_amd64.deb ...
Unpacking python3.9 (3.9.13-1+bionic1) over (3.9.6-1+bionic1) ...
Preparing to unpack .../2-libpython3.9-stdlib_3.9.13-1+bionic1_amd64.deb ...
Unpacking libpython3.9-stdlib:amd64 (3.9.13-1+bionic1) over (3.9.6-1+bionic1) ...
dpkg: error processing archive /tmp/apt-dpkg-install-RMgxYd/2-libpython3.9-stdlib_3.9.13-1+bionic1_amd64.deb (--unpack):
 trying to overwrite '/usr/lib/python3.9/_sysconfigdata__linux_x86_64-linux-gnu.py', which is also in package libpython3.9-minimal:amd64 3.9.6-1+bionic1
Preparing to unpack .../3-python3.9-minimal_3.9.13-1+bionic1_amd64.deb ...
Unpacking python3.9-minimal (3.9.13-1+bionic1) over (3.9.6-1+bionic1) ...
Preparing to unpack .../4-libpython3.9-minimal_3.9.13-1+bionic1_amd64.deb ...
Unpacking libpython3.9-minimal:amd64 (3.9.13-1+bionic1) over (3.9.6-1+bionic1) ...
dpkg: error processing archive /tmp/apt-dpkg-install-RMgxYd/4-libpython3.9-minimal_3.9.13-1+bionic1_amd64.deb (--unpack):
 trying to overwrite '/usr/lib/python3.9/typing.py', which is also in package libpython3.9-stdlib:amd64 3.9.6-1+bionic1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Selecting previously unselected package libpython3.9:amd64.
Preparing to unpack .../5-libpython3.9_3.9.13-1+bionic1_amd64.deb ...
Unpacking libpython3.9:amd64 (3.9.13-1+bionic1) ...
Selecting previously unselected package libpython3.9-dev:amd64.
Preparing to unpack .../6-libpython3.9-dev_3.9.13-1+bionic1_amd64.deb ...
Unpacking libpython3.9-dev:amd64 (3.9.13-1+bionic1) ...
Selecting previously unselected package python3.9-dev.
Preparing to unpack .../7-python3.9-dev_3.9.13-1+bionic1_amd64.deb ...
Unpacking python3.9-dev (3.9.13-1+bionic1) ...
Errors were encountered while processing:
 /tmp/apt-dpkg-install-RMgxYd/2-libpython3.9-stdlib_3.9.13-1+bionic1_amd64.deb
 /tmp/apt-dpkg-install-RMgxYd/4-libpython3.9-minimal_3.9.13-1+bionic1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

It seems that there's a conflict between the libpython minimal and stdlib packages. I'm a bit out of my depth here otherwise and I'm not sure how to proceed. I did try:

$sudo apt install python3.9-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
python3.9-dev is already the newest version (3.9.13-1+bionic1).
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 libpython3.9 : Depends: libpython3.9-stdlib (= 3.9.13-1+bionic1) but 3.9.6-1+bionic1 is to be installed
 libpython3.9-dev : Depends: libpython3.9-stdlib (= 3.9.13-1+bionic1) but 3.9.6-1+bionic1 is to be installed
 python3.9 : Depends: libpython3.9-stdlib (= 3.9.13-1+bionic1) but 3.9.6-1+bionic1 is to be installed
 python3.9-minimal : Depends: libpython3.9-minimal (= 3.9.13-1+bionic1) but 3.9.6-1+bionic1 is to be installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
$ sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
  libpython3.9-minimal libpython3.9-stdlib
The following packages will be upgraded:
  libpython3.9-minimal libpython3.9-stdlib
2 upgraded, 0 newly installed, 0 to remove and 334 not upgraded.
6 not fully installed or removed.
Need to get 0 B/2,485 kB of archives.
After this operation, 72.7 kB of additional disk space will be used.
Do you want to continue? [Y/n] 
(Reading database ... 184205 files and directories currently installed.)
Preparing to unpack .../libpython3.9-stdlib_3.9.13-1+bionic1_amd64.deb ...
Unpacking libpython3.9-stdlib:amd64 (3.9.13-1+bionic1) over (3.9.6-1+bionic1) ...
dpkg: error processing archive /var/cache/apt/archives/libpython3.9-stdlib_3.9.13-1+bionic1_amd64.deb (--unpack):
 trying to overwrite '/usr/lib/python3.9/_sysconfigdata__linux_x86_64-linux-gnu.py', which is also in package libpython3.9-minimal:amd64 3.9.6-1+bionic1
Preparing to unpack .../libpython3.9-minimal_3.9.13-1+bionic1_amd64.deb ...
Unpacking libpython3.9-minimal:amd64 (3.9.13-1+bionic1) over (3.9.6-1+bionic1) ...
dpkg: error processing archive /var/cache/apt/archives/libpython3.9-minimal_3.9.13-1+bionic1_amd64.deb (--unpack):
 trying to overwrite '/usr/lib/python3.9/typing.py', which is also in package libpython3.9-stdlib:amd64 3.9.6-1+bionic1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/libpython3.9-stdlib_3.9.13-1+bionic1_amd64.deb
 /var/cache/apt/archives/libpython3.9-minimal_3.9.13-1+bionic1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

UPDATE: Per this answer I completely purged py3.9, then apt update / upgrade / install worked.

elhefe
  • 111
  • 334 not upgraded means you're missing a lot of updates. Always make sure your system is fully updated before installing new software. – ChanganAuto Aug 12 '22 at 16:41
  • So you should fix your software sources before anything else. – ChanganAuto Aug 12 '22 at 16:44
  • software upgrade, n: the act of replacing a set of known bugs with workarounds for a set of unknown bugs without workarounds – elhefe Aug 12 '22 at 17:14
  • unfortunately sudo apt upgrade fails in the same way that the sudo apt install command above fails, so things look pretty borked – elhefe Aug 12 '22 at 17:16
  • Same with sudo apt remove python3.9-dev – elhefe Aug 12 '22 at 17:18
  • 1
    Your software must be up-to-date before you add new software. Based on your sarcastic comment about bugs, I'd be willing to bet you're responsible for these kinds of problems because you actively avoid updates which are considered basic system maintenance. You're wrong about updates. Don't double down. If you insist on installing new software while your system is outdated, of course you're going to create problems and conflicts with your package management. You're going to have to solve any preexisting package management problems before you start trying to solve a new one. – Nmath Aug 12 '22 at 19:08
  • FYI - changing the python interpreter on your system will cause your system to crash in most cases. A great deal of the software in Ubuntu uses python. If you need a different python interpreter for some task, you should research how to use virtual environments so you don't mess up your system with a different python interpreter. Adding PPAs and other sources can also cause problems if the PPAs are outdated or if they contain versions of software that conflict with the software in your distro's repos. – Nmath Aug 12 '22 at 19:13
  • re the sarcastic comment, it was tongue in cheek, although I think there's some truth to it. That being said, as I mentioned I can't upgrade at this point, so any ideas on how to get out of this (self-induced) mess? – elhefe Aug 12 '22 at 19:17
  • re the python interpreter - I have several different interpreters installed on my system without issue and use pipenv, so no issues there – elhefe Aug 12 '22 at 19:18
  • I'm at a loss how can you claim "no issues" when you are very clearly coming to us with multiple issues? You need to bring your system up-to-date and your package manager needs to stop giving errors before you try to add this new software. That is the problem you need to research and troubleshoot first. You may need to remove problematic PPAs and other manually installed or manually held back software in order to resolve dependencies – Nmath Aug 12 '22 at 19:23
  • I'm claiming no issues specifically re changing the python interpreter, not in general. In any case, I'm not changing the interpreter, I'm installing the headers for an interpreter that already exists on the system – elhefe Aug 12 '22 at 19:31

0 Answers0