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.
sudo apt upgrade
fails in the same way that thesudo apt install
command above fails, so things look pretty borked – elhefe Aug 12 '22 at 17:16sudo apt remove python3.9-dev
– elhefe Aug 12 '22 at 17:18