Choosing a Specific Python Runtime with Fedora DNF Modules
Learn how to pick a precise Python version via Fedora DNF modules, see a concrete install example, and understand version lock trade‑offs.
04 Nov 2025, 18:57 UTC

What DNF modules and streams are
Fedora’s DNF package manager groups related software into modules. Each module can provide multiple streams, which are alternative versions of the same runtime (for example, python:3.9, python:3.10, python:3.11). The stream you enable determines which binary packages DNF will select when you install or upgrade software.
Enabling a stream and installing a package
To pick a specific runtime version you run two commands. First list the streams that the module offers, then enable the desired one. After that, installing a package pulls it from the active stream.
- List available streams:
sudo dnf module list module_name - Enable the stream you need (replace stream with the version tag):
sudo dnf module enable module_name[:stream] - Install or update the package:
sudo dnf install package - Verify the active stream:
dnf info package | grep Stream
These steps require root privileges (sudo). The placeholder module_name is the module identifier, and stream is the version tag such as 3.11.
Version lock and compatibility trade‑offs
Enabling a non‑default stream can introduce dependency sets that differ from those installed under the default stream. When major versions change (for example, moving from python:3.9 to python:3.11) existing packages may no longer be compatible, leading to transaction check failures. DNF5 enforces stricter stream locking, so if two modules reference incompatible streams the install may abort. This is a practical limitation to keep in mind.
Worked example: installing Python 3.11
Suppose you need Python 3.11 for a new project while the system currently provides python:3.9 as the default.
- Check the streams available for the python module:
sudo dnf module list python - Enable the 3.11 stream:
sudo dnf module enable python:3.11 - Install the interpreter:
sudo dnf install python3 - Confirm the stream in use:
dnf info python3 | grep Stream
If the output shows Stream: 3.11, the correct version is active. To switch back to the default 3.9 stream, run sudo dnf module reset python followed by sudo dnf module enable python:3.9 and reinstall or update as required.
Limitation and actionable closing
The module metadata lives in each repository; adding a third‑party repo can disable stream support entirely. Also, a transaction that mixes modules with conflicting streams may fail the dependency check. To avoid surprises, always verify the Stream field after enabling a stream, and test the installation in a non‑production environment first.
In practice, the workflow is: enable the desired stream, install the needed package, confirm the version, and, when a change is required, reset the module and re‑enable the new stream before proceeding. This ensures your Fedora system runs the exact runtime you selected.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.