Score:0

Broken python3.9 after upgrade from 20.04 to 21.04

tk flag

Pretty much everything seems to be working fine except the gnome settings application. Selecting, for instance, the "display settings" under the right top menu on the desktop does not open the settings window as it used to do. I quickly realized that gnome-control-center is not installed and I run sudo apt install gnome-control-center to install it. I got

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:
 libpython3.9 : Depends: libpython3.9-stdlib (= 3.9.5-3~21.04) but 3.9.7-1+focal1 is to be installed
E: Unable to correct problems, you have held broken packages.

Long story short, I have 4 python3.9 packages from focal:

$ apt list --installed | grep python |grep -v "hirsute"
    
libpython3.9-minimal/now 3.9.7-1+focal1 amd64 [installed,local]
libpython3.9-stdlib/now 3.9.7-1+focal1 amd64 [installed,local]
python3.9-minimal/now 3.9.7-1+focal1 amd64 [installed,local]
python3.9/now 3.9.7-1+focal1 amd64 [installed,local]

Needless to say, the rest are there and they are hirsute.

Am I to download the hirsute version of these packages and install with dpkg -i --force-all or is there another, possibly easier way?

user535733 avatar
cn flag
Stop and read your output carefully: The error occurs because the system wants to install an *older* package than you have installed. Those '`+focal1` packages are not from the Ubuntu repositories. Whatever PPA or non-Ubuntu source you previously used to install Py3.9 on 20.04 *is still there*. Delete that non-Ubuntu source and remove any remaining packages you installed from it.
N0rbert avatar
zw flag
Does this answer your question? [How do I restore the default repositories?](https://askubuntu.com/questions/124017/how-do-i-restore-the-default-repositories)
karel avatar
sa flag
Does this answer your question? [Unable to correct problems, you have held broken packages](https://askubuntu.com/questions/223237/unable-to-correct-problems-you-have-held-broken-packages)
tk flag
Thanks @user535733 but I had already checked that. Nothing but hirsute repo in the sources: `# egrep -v "^#" /etc/apt/sources.list deb http://mirror.hostnet.nl/ubuntu/archive/ hirsute main restricted deb http://mirror.hostnet.nl/ubuntu/archive/ hirsute-updates main restricted deb http://mirror.hostnet.nl/ubuntu/archive/ hirsute universe deb http://mirror.hostnet.nl/ubuntu/archive/ hirsute-updates universe deb http://mirror.hostnet.nl/ubuntu/archive/ hirsute multiverse deb http://mirror.hostnet.nl/ubuntu/archive/ hirsute-updates multiverse`
tk flag
I am suffering from the misfortune of having installed python3.9 while I was on 20.04 and not having purged it before the upgrade. Though, in retrospect, who would have thought that the installer could not deal with that. After all, the installer disabled all other repos, upgraded necessary packages and removed the unnecessary ones.
user535733 avatar
cn flag
I completely agree with your diagnosis. Retrospect can be funny that way: **EVERYBODY** here knows about changing their Python. Every day, we exhort folks to not change their default Python for exactly the reason you encountered. This site is knee-deep in the tears of folks who destroyed their systems by changing their Python. There are safe ways to do it, but the unsafe ways are so much easier and posted everywhere online.
tk flag
True... Though, the default was 3.7 on 20.04. I had installed 3.9 some time ago as an alternative (I kept the 3.7) and forgotten about it. And neither it occured to me that 3.9 might be default on 21.04, nor the possibility of upgrade process failing to handle the situation. Anyway, `wget` and `dpkg` were to the rescue. Solution posted.
Score:0
tk flag

I was able to resolve the issue by downlading the correct packages and installing them with dpkg:

wget http://security.ubuntu.com/ubuntu/pool/main/p/python3.9/libpython3.9-stdlib_3.9.5-3~21.04_amd64.deb
wget http://nl.archive.ubuntu.com/ubuntu/pool/main/m/mpdecimal/libmpdec3_2.5.1-2_amd64.deb
wget http://security.ubuntu.com/ubuntu/pool/main/p/python3.9/python3.9-minimal_3.9.5-3~21.04_amd64.deb
wget http://security.ubuntu.com/ubuntu/pool/main/p/python3.9/python3.9_3.9.5-3~21.04_amd64.deb


dpkg -i libmpdec3_2.5.1-2_amd64.deb 
dpkg -i libpython3.9-stdlib_3.9.5-3~21.04_amd64.deb 
dpkg -i python3.9-minimal_3.9.5-3~21.04_amd64.deb
dpkg -i python3.9_3.9.5-3~21.04_amd64.deb

libmpdec3 was shown as a missing dependency when I tried to install the libpython3.9-stdlib so I installed that as well. The more the merry :)

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.