Score:0

netplan with multiple versions of python

tk flag

Currently, I have two versions of python installed in Ubuntu 20.04. I noticed that if I select python3.10 as python3, then netplan got errors. If I switch back to python3.8, then netplan works fine. The command I use is

sudo update-alternatives --config python3

I also tried to uninstall netplan and python3.8, and reinstall netplan, then python3.8 is installed back. It seems no matter what I do, apt always uses python3.8(the original version of python). Why?

guiverc avatar
cn flag
Ubuntu systems (esp. desktop) rely on the default python3 being the version the system shipped (*or was upgraded to*) as many Ubuntu tools rely on python3 to work. You should never change the default `python3` version especially for desktop systems if you want to rely on your system working reliably (Ubuntu tools continue to working, or worse causing corruption because they work incorrectly due to python3 version change). Don't change the default python3 version except in protected environments (ie. don't change your system default).
us flag
@guiverc please make this comment an answer
Score:0
cn flag

Ubuntu systems (esp. desktop) rely on the default python3 being the version the system shipped (or was upgraded to) as many Ubuntu tools rely on python3 to work.

You should never change the default python3 version especially for desktop systems if you want to rely on your system working reliably. Many Ubuntu tools use (default) python3, and changing the version can cause them to stop working (the best that can happen) or worse they work incorrectly causing corruption due to python3 version change & differences between versions (this normally only destroys the Ubuntu system (such as package databases etc) & not your data, but results can vary being undefined).

Don't change the default python3 version except in protected environments (where you're not changing the default; ie. don't change your system default)


I'm not using focal or 20.04, but a quick exploration of netplan on my own system shows

guiverc@d7050-next:~/uwn/issues/793$   apt-cache depends netplan.io
netplan.io
  Depends: libc6
  Depends: libglib2.0-0
  Depends: libnetplan0
  Depends: libsystemd0
  Depends: iproute2
    iproute2:i386
  Depends: python3
  Depends: python3-dbus
  Depends: python3-rich
  Depends: python3-yaml
  Depends: python3-netifaces
  Depends: systemd
    systemd:i386
  Conflicts: <netplan>
  Breaks: <nplan>
 |Suggests: network-manager
  Suggests: wpasupplicant
  Suggests: openvswitch-switch
  Suggests: iw
  Replaces: <nplan>

ie. Netplan on my system relies on python3 that came with my system (Ubuntu mantic)

guiverc avatar
cn flag
Sorry, I have no interest in modifying my details to reflect *focal* instead of *mantic* which is what I'm currently using... but I'd expect the same or very similar results on *focal*.
定坤宋 avatar
tk flag
You are absolutely right @guiverc. At first I thought "update-alternatives" can switch to another python version smoothly, but that is not the case. After I removed python3.8 from Ubuntu20.04, my desktop crashed and forced me into tty1 terminal. Then I reinstalled python3.8 and ubuntu-desktop, everything goes back to normal.
guiverc avatar
cn flag
If using a Server system (no desktop/GUI), and stay away from tools that rely on `python3` (easier on Server systems than desktops) you'll find it is possible, though you'll still need to reverse that at times as many tools won't be available to you until defaults are returned (*eg. you may get away with it until release-upgrade time if you're lucky, but it'll very much depend on how you use your system as to how much it impacts you*)
I sit in a Tesla and translated this thread with Ai:

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.