I'm using Ubuntu 22.04.3 Server. I've installed nala
using the Volian Scar repo. Recently, this repo has included a number of updated Python 3 packages, including python3-anyio
.
However, this particular package will not upgrade:
$ sudo apt full-upgrade
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following NEW packages will be installed:
python3-mdurl
The following packages have been kept back:
python3-anyio
The following packages will be upgraded:
python3-click python3-httpcore python3-markdown-it python3-pygments python3-rich python3-typer python3-typing-extensions
7 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
...
And if I try to force install python3-anyio
, I get the exact reason:
$ sudo apt install --reinstall --dry-run python3-anyio
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
python3-anyio : Depends: python3-exceptiongroup but it is not installable or
python3 (> 3.11) but 3.10.6-1~22.04 is to be installed
E: Unable to correct problems, you have held broken packages.
It's now evident that this updated package requires Python 3 "Exception Groups", which are either included in Python 3.11 (Ubuntu 22.04 uses Python 3.10), or in the backported package python3-exceptiongroup
.
Searching for this package on Ubuntu Package archive reveals that this package is part of the Universe repository, but only for Ubuntu 23.04 (Lunar) or 23.10 (Mantic).
What options do I have to avoid dependency issues in this situation when I still want to upgrade my packages?
FYI, this has already been reported as an issue with Volian. I assume the package python3-exceptiongroup
should be added to the Volian repo in the future.
ALAS, python3-exceptiongroup
has already been added to the Volian Scar repo, so now this dependency error does not show up anymore. Still, the method in this Q&A could be used in other similar situations.
Generally, you'll have two options here:
python3-anyio
(so this particular package is not upgraded), orpython3-exceptiongroup
manually.1. Hold the package
python3-anyio
Run this command to hold back the package
python3-anyio
:View held packages with:
Now, when you run an upgrade command,
python3-anyio
will always stay at the current version.If you at a later time wish to upgrade the package, unhold it with:
2. Install
python3-exceptiongroup
manuallyThis method requires that you manually download a copy of the
python3-exceptiongroup
package and install it. In this case, I would opt for downloading the latest version directly from the Debian Sid repo. (Since this is an add-on package for Python 3, I imagine the risk of another dependency issue here is negligible.)Then install it:
Now
python3-anyio
will have met its dependencies, which is evident by running:Now you can finally run your full upgrade command without any packages being held back: