Core26: bundled Python changes

Core base snaps (e.g. core22, core24) provide a run-time environment with a minimal set of libraries that are common to many applications.

Core base snaps up to and including core24 bundle the Python interpreter alongside a selection of Python libraries. But from core26 onwards, Python packages will no longer be included. This change does not affect earlier core base snaps.

The majority of application snaps that need Python already stage Python independently. These snaps will not need to be modified.

If your snap relies on the Python interpreter provided by the core snap, and you are switching or planning to use the new core26 base and later versions, you will need to add the Python plugin to your snap.

Why are we making this change?

We continuously simplify core base snaps to remove unnecessary dependencies, improve maintainability, reduce attack surface, and keep the runtime environment minimal and predictable. In this context, core bases historically shipped some Python dependencies.

However, the recommended approach for snap creators has always been to use the Python plugin and bundle their own Python runtime inside their application snaps, including only the packages and dependencies they require. As a result, the Python interpreter and libraries provided by core snaps are often unused.

For this reason, starting with core26, the Python environment in the core base snap won’t be available at runtime.

This change better reflects how snaps are built and used today, where snap developers retain full control over their Python versions and dependencies. It also allows for the core base to be simplified. Over time, this will also allow for a reduction in the overall size of the core snaps.

How to manage the Python environment in your snap

Developers publishing snaps with Python-based parts can continue to use the Snapcraft Python plugin, which allows you to bundle the exact Python version and dependencies your application requires. Detailed guidance is available in the How-to Guide Craft a Python app

For projects that use Poetry or uv, developers should consider using the separate Snapcraft plugins built for these dependency management tools. A full list of available plugins and their usage is available in the Plugin Reference.

Impact on cloud-init

This change does not affect cloud-init usage, which will remain present and fully supported in this release.

However, since not every user requires cloud-init, a new track will be available for core26. This track will include cloud-init and the Python environment it needs.

Questions or comments?

If you have questions or concerns about this transition, please share them below.

9 Likes

I wholeheartedly support this change! Thanks for the details @ndyer

1 Like

Will the desktop extensions have a Python bundle with them?

I can see this being okay for Ubuntu Core scenarios and apps that don’t make use of Python - but in a broader desktop context I personally think that having an externally managed Python, if not by the base snap, by the extension snaps, is ideal.

Python is such as a common component generally that I feel it’s very likely there’s a lot of tools that make use of it without checking/ensuring it’s actually there. On Ubuntu itself Python is essentially a critical component of the OS not to be messed with given how much relies on it. Some applications might only use it extremely infrequently, but make assumptions that it’s there for one off jobs.

In desktop land then, that means it only takes 1 app to use Python to lose the benefits of being space efficient, whilst making it another package that people have to rebuild their snaps for for security reasons. To me it’d make sense for the Gnome/KDE/etc content snaps for Core26 to have the same Python version as Ubuntu 26.04 itself by default.

I’m not against the idea by itself and don’t know contexts around the decision making for it, but personally I feel for desktop use, there’s more to lose than gain with this change, so having the extensions compensate a little would be nice.

If I’m not mistaken, the content Snaps for the gnome and kde-neon-6 extensions basically add the Python that’s available in the repository.

So they won’t be affected by the lack of Python in the core26 Snap.

Judging by gnome-sdk/snap/snapcraft.yaml at f72fca3a29abef1285e2f18c89f744a01754cc03 · ubuntu/gnome-sdk · GitHub and a few other lines, it looks like Python in the Gnome content snap is removed explicitly, which would make sense with it overlapping with Core; but I think should be reconsidered in Core26.

james@James-Desktop:~/squashfs-root$ unsquashfs gnome-46-2404_153.snap
james@James-Desktop:~$ cd squashfs-root/
james@James-Desktop:~/squashfs-root$ find . -name 'python'
>