9

I'm curious if Ubuntu "pins" minor Python versions for each of its releases. Looking at the package details for python3 in Focal, compared to other LTS releases, e.g. Bionic seems to be sticking to Python 3.6. Is this documented anywhere to be true? Or is it just the status quo at the moment? Or am I misunderstanding Ubuntu packages?

I did find a related question, but not quite in the same vein so it didn't answer my question: Pin Python minor version in Ubuntu 18.04.4 LTS

wjandrea
  • 14,109
  • 4
  • 48
  • 98

1 Answers1

19

Your understanding is accurate.

A release of Ubuntu sticks with the same 3.x release of Python for the entire life of that Ubuntu release. Ubuntu 18.04 (Bionic) will indeed stick to Python 3.6 until Bionic reaches EOL in 2028.

  • Ubuntu 20.04 = Python 3.8
  • Ubuntu 22.04 = Python 3.10

Sticking to a single version for the life of the release of Ubuntu is the way that Debian-based distros have worked for over 20 years: With a couple exceptions, all software uses a single common set of dependencies. Only security patches and bugfixes that don't break the common set are pushed after release. New versions tend to break that common set of dependencies, so new versions await the next release. That's one of the reasons that Ubuntu releases anew every six months.

Many distros, including Ubuntu, use a lot of Python under the hood. Changing the Python version can break things. Example: This site is soaked in the tears of folks who broke apt by changing their version of Python.

user535733
  • 58,040
  • 10
  • 106
  • 136
  • 4
    Very good: "soaked in the tears"! No one should play around with python versions in Ubuntu (and most other distros) – kanehekili Aug 18 '22 at 00:06
  • Very insightful +1. Can I somehow see which version of python, or any package, is pinned in my system? – Jos Aug 18 '22 at 12:09
  • 1
    Well, a 'pin' actually has a definition different from your use, which is why I did not use that term. Apt will happily tell you what versions of any particular package you have installed on your release of Ubuntu. See `man apt-cache` for lots of information about version information. – user535733 Aug 18 '22 at 16:58
  • 1
    @user535733 You don't need `apt-cache`, you can simply use `apt`, i.e. `apt show python3` and check the "Version" line. – wjandrea Aug 18 '22 at 17:39
  • @user535733 Cool, looks like it's implicitly documented here: https://wiki.ubuntu.com/StableReleaseUpdates – wjandrea Aug 18 '22 at 18:21
  • Real examples: [Gnome terminal will not start](/q/880188/301745), [apt-get upgrade does not work after updating python](/q/1374341/301745) – wjandrea Aug 18 '22 at 18:43
  • It is perhaps worth noting that Ubuntu (following the Debian convention) actually goes further, and sticks to a single patch release for any given distro version. 18.04 still ships 3.6.5 (plus security patches), rather than the newest 3.6, which I believe is 3.6.15. – James_pic Aug 19 '22 at 12:31