Stuck upgrading parts of 3.10 from 3.10.3 to 3.10.4

This isn’t strictly speaking a Python issue, but it involves upgrade of Python on a Debian-like system (whatever Oracle calls their Linux). I use 3.10 on my website, and Oracle told me there were some updates to perform, so I executed:

apt update
apt upgrade

That worked except for two packages which seem stuck:

% apt upgrade
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.10 : Depends: libpython3.10-stdlib (= 3.10.4-1+focal2) but 3.10.3-1+focal1 is installed
python3.10-minimal : Depends: libpython3.10-minimal (= 3.10.4-1+focal2) but 3.10.3-1+focal1 is installed
E: Unmet dependencies. Try ‘apt --fix-broken install’ with no packages (or specify a solution).

I tried the suggested fix but that didn’t help:

% apt --fix-broken install
Reading package lists… Done
Building dependency tree
… …
Unpacking libpython3.10-stdlib:amd64 (3.10.4-1+focal2) over (3.10.3-1+focal1) …
… …
Unpacking libpython3.10-minimal:amd64 (3.10.4-1+focal2) over (3.10.3-1+focal1) …
dpkg: error processing archive /var/cache/apt/archives/libpython3.10-minimal_3.10.4-1+focal2_amd64.deb (–unpack):
trying to overwrite ‘/usr/lib/python3.10/’, which is also in package libpython3.10-stdlib:amd64 3.10.3-1+focal1
dpkg-deb: error: paste subprocess was killed by signal (Broken pipe)
Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)

It would appear that I am actually at 3.10.4:

% apt list | egrep ‘python3.10.*3.10.4’

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

idle-python3.10/focal 3.10.4-1+focal2 all
libpython3.10-dbg/focal 3.10.4-1+focal2 amd64
libpython3.10-dev/focal 3.10.4-1+focal2 amd64
libpython3.10-minimal/focal 3.10.4-1+focal2 amd64 [upgradable from: 3.10.3-1+focal1]
libpython3.10-stdlib/focal 3.10.4-1+focal2 amd64 [upgradable from: 3.10.3-1+focal1]
libpython3.10-testsuite/focal 3.10.4-1+focal2 all
libpython3.10/focal 3.10.4-1+focal2 amd64
libqgispython3.10.4/focal 3.10.4+dfsg-1ubuntu2 amd64
python3.10-dbg/focal 3.10.4-1+focal2 amd64
python3.10-dev/focal 3.10.4-1+focal2 amd64
python3.10-distutils/focal,now 3.10.4-1+focal2 all [installed,automatic]
python3.10-examples/focal 3.10.4-1+focal2 all
python3.10-full/focal 3.10.4-1+focal2 amd64
python3.10-gdbm-dbg/focal 3.10.4-1+focal2 amd64
python3.10-gdbm/focal 3.10.4-1+focal2 amd64
python3.10-lib2to3/focal,now 3.10.4-1+focal2 all [installed,automatic]
python3.10-minimal/focal,now 3.10.4-1+focal2 amd64 [installed,automatic]
python3.10-tk-dbg/focal 3.10.4-1+focal2 amd64
python3.10-tk/focal 3.10.4-1+focal2 amd64
python3.10-venv/focal,now 3.10.4-1+focal2 amd64 [installed]
python3.10/focal,now 3.10.4-1+focal2 amd64 [installed]
% python3.10
Python 3.10.4 (main, Apr 8 2022, 17:35:13) [GCC 9.4.0] on linux
Type “help”, “copyright”, “credits” or “license” for more information.

but there is some record wrong in some dpkg database.

% apt list -a libpython3.10-minimal
Listing… Done
libpython3.10-minimal/focal 3.10.4-1+focal2 amd64 [upgradable from: 3.10.3-1+focal1]
libpython3.10-minimal/now 3.10.3-1+focal1 amd64 [installed,upgradable to: 3.10.4-1+focal2]

% apt list -a python3.10
Listing… Done
python3.10/focal,now 3.10.4-1+focal2 amd64 [installed]

I am unclear how to proceed from here. Any suggestions for how to fix this (or where a better place to ask this not-really-python question)?

The first thing I’d try is:

apt autoremove
apt autoclean

Then try the update and upgrade again.

This doesn’t look like Oracle Linux, which is a RHEL/RPM derived
distribution. The use of APT/DEB packages and references to “focal”
in package revisions make me suspect it’s something based on Ubuntu
20.04 LTS, however that Ubuntu release doesn’t have any official
Python 3.10 packages (not yet anyway, though I’m told supported
backports are in the works).

The short answer is that it looks like whoever is maintaining these
3.10 packages decided to move the module from
libpython3.10-stdlib (which normally houses the majority of Python’s
“batteries included” standard library of modules) to the
libpython3.10-minimal package (which includes the more commonly used
remainder of modules), or otherwise accidentally included the file
in both packages. Since I don’t know where you obtained these
packages, it’s hard to inspect them to know exactly which is the

For the record, the Python 3.10 packages in Debian sid/bookworm and
Ubuntu releases from 21.04 (where they were first included) to
current all include in the minimal set, not the stdlib
package. This looks like a transitional problem created by whoever
is maintaining the packages you’re using, and your best bet is to
reach out to them for assistance rather than trying to perform
surgery on your package database.

Thanks for the suggestion. I do recognize the maintainer. I’ll reach out to him directly.

(As for autoremove & autoclean, the former is stmied by the apparent conflict, the latter seems to do nothing.)

Yeah, my bad. It is some flavor of Ubuntu 20.04:

% uname -a
Linux instance-20211222-1239 5.13.0-1021-oracle #26~20.04.1-Ubuntu SMP Mon Mar 7 14:26:06 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

Once I got the instance up and running, I have basically just ignored it. Previous updates all worked just fine. This is the first problem I’ve encountered with an upgrade.

Closing this out with my eventual solution in case others encounter the same (or similar) problem. The checked answer on this AskUbuntu question

provided the solution, effectively purge the offending packages and reinstall. I have yet to restart nginx or my gunicorn instance (which is what uses Python), so I may encounter other problems. I’ll get to that eventually. For now, the website is up.