3

Recently did a dist-upgrade and I managed to get into some completely broken state.

% sudo apt upgrade
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
 hplip : Depends: hplip-data (= 3.22.10+dfsg0-2) but 3.22.6+dfsg0-1 is installed
         Depends: printer-driver-hpcups (= 3.22.10+dfsg0-2) but 3.22.6+dfsg0-1 is installed
         Depends: python3 (>= 3.11~) but 3.10.6-1 is installed
 libpython3-dev : Depends: libpython3.11-dev (>= 3.11.2-1~) but it is not installed
 mercurial : Depends: python3 (>= 3.11~) but 3.10.6-1 is installed
 python3-apt : Depends: python3 (>= 3.11~) but 3.10.6-1 is installed
 python3-cairo : Depends: python3 (>= 3.11~) but 3.10.6-1 is installed
 python3-cffi-backend : Depends: python3 (>= 3.11~) but 3.10.6-1 is installed
 python3-dbus : Depends: python3 (>= 3.11~) but 3.10.6-1 is installed
 python3-dev : Depends: python3 (= 3.11.2-1) but 3.10.6-1 is installed
               Depends: python3.11-dev (>= 3.11.2-1~) but it is not installed
               Depends: python3-distutils (>= 3.11.2-1~) but 3.10.7-1 is installed
 python3-gi : Depends: python3 (>= 3.11~) but 3.10.6-1 is installed
 python3-gi-cairo : Depends: python3 (>= 3.11~) but 3.10.6-1 is installed
 python3-lxml : Depends: python3 (>= 3.11~) but 3.10.6-1 is installed
 python3-markupsafe : Depends: python3 (>= 3.11~) but 3.10.6-1 is installed
 python3-pil : Depends: python3 (>= 3.11~) but 3.10.6-1 is installed
 python3-pycurl : Depends: python3 (>= 3.11~) but 3.10.6-1 is installed
 python3-renderpm : Depends: python3 (>= 3.11~) but 3.10.6-1 is installed
 python3-reportlab-accel : Depends: python3 (>= 3.11~) but 3.10.6-1 is installed
 python3-venv : Depends: python3.11-venv (>= 3.11.2-1~) but it is not installed
                Depends: python3 (= 3.11.2-1) but 3.10.6-1 is installed
                Depends: python3-distutils (>= 3.11.2-1~) but 3.10.7-1 is installed
 python3-yaml : Depends: python3 (>= 3.11~) but 3.10.6-1 is installed
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).

When I try to run apt install -f:

% sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
  hplip-data libpython3-stdlib libpython3.11-dev printer-driver-hpcups python3 python3-distutils python3-lib2to3 python3-minimal python3-numpy python3.11-dev
  python3.11-venv
Suggested packages:
  hplip-doc python3-doc python3-tk python3-pytest
The following packages will be REMOVED:
  python3.10-venv
The following NEW packages will be installed:
  libpython3.11-dev python3.11-dev python3.11-venv
The following packages will be upgraded:
  hplip-data libpython3-stdlib printer-driver-hpcups python3 python3-distutils python3-lib2to3 python3-minimal python3-numpy
8 upgraded, 3 newly installed, 1 to remove and 4 not upgraded.
31 not fully installed or removed.
Need to get 0 B/17.8 MB of archives.
After this operation, 36.4 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Traceback (most recent call last):
  File "/usr/bin/apt-listchanges", line 29, in <module>
    import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
(Reading database ... 410707 files and directories currently installed.)
Preparing to unpack .../python3-numpy_1%3a1.24.2-1_amd64.deb ...
Unpacking python3-numpy (1:1.24.2-1) over (1:1.21.5-1+b1) ...
dpkg: error processing archive /var/cache/apt/archives/python3-numpy_1%3a1.24.2-1_amd64.deb (--unpack):
 trying to overwrite '/usr/bin/f2py', which is also in package python-numpy 1:1.16.2-1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/python3-numpy_1%3a1.24.2-1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Based on https://stackoverflow.com/questions/13708180/python-dev-installation-error-importerror-no-module-named-apt-pkg I tried:

% cd /usr/lib/python3/dist-packages 
% sudo ln -s apt_pkg.cpython-311-x86_64-linux-gnu.so apt_pkg.so
% sudo apt --fix-broken install
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Correcting dependencies... Done
The following additional packages will be installed:
  hplip-data libpython3-stdlib libpython3.11-dev printer-driver-hpcups python3 python3-distutils python3-lib2to3 python3-minimal python3-numpy python3.11-dev
  python3.11-venv
Suggested packages:
  hplip-doc python3-doc python3-tk python3-pytest
The following packages will be REMOVED:
  python3.10-venv
The following NEW packages will be installed:
  libpython3.11-dev python3.11-dev python3.11-venv
The following packages will be upgraded:
  hplip-data libpython3-stdlib printer-driver-hpcups python3 python3-distutils python3-lib2to3 python3-minimal python3-numpy
8 upgraded, 3 newly installed, 1 to remove and 4 not upgraded.
31 not fully installed or removed.
Need to get 0 B/17.8 MB of archives.
After this operation, 36.4 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Reading changelogs... Done
(Reading database ... 410707 files and directories currently installed.)
Preparing to unpack .../python3-numpy_1%3a1.24.2-1_amd64.deb ...
Unpacking python3-numpy (1:1.24.2-1) over (1:1.21.5-1+b1) ...
dpkg: error processing archive /var/cache/apt/archives/python3-numpy_1%3a1.24.2-1_amd64.deb (--unpack):
 trying to overwrite '/usr/bin/f2py', which is also in package python-numpy 1:1.16.2-1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
 /var/cache/apt/archives/python3-numpy_1%3a1.24.2-1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

I got the same errors from

% sudo mv /usr/bin/python3 /usr/bin/python3.old
% sudo ln -s /usr/bin/python3.11 /usr/bin/python3
% sudo apt --fix-broken install

(both in combination with above and in isolation)

I am not sure where to go from here.

0

1 Answer 1

3

The problem boils down to

dpkg: error processing archive /var/cache/apt/archives/python3-numpy_1%3a1.24.2-1_amd64.deb (--unpack):
 trying to overwrite '/usr/bin/f2py', which is also in package python-numpy 1:1.16.2-1

The Python 2 python-numpy package was removed in Debian 11; you should remove it too:

sudo dpkg --purge python-numpy

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.