How to Install Python 3.14 on Ubuntu 26.04, 24.04 and 22.04

Install Python 3.14 on Ubuntu 26.04, 24.04 and 22.04 via Deadsnakes PPA or source build. Covers free-threaded support, troubleshooting.

UpdatedPublished AuthorJoshua JamesRead time14 minGuide typeUbuntu

Python 3.14 brings deferred evaluation of annotations, template strings, standard-library subinterpreters, and free-threaded runtime improvements. To install Python 3.14 on Ubuntu, use the channel that matches your release so apt and OS tooling keep working without conflicts.

Ubuntu 26.04 LTS uses Python 3.14 as its default system interpreter, so most users only need add-on packages such as python3.14-venv or python3.14-dev. Ubuntu 24.04 LTS and 22.04 LTS install Python 3.14 beside their default interpreters through the Deadsnakes PPA, while source compilation remains available on the supported releases covered here for custom or free-threaded builds.

Install Python 3.14 on Ubuntu

Choose a Python 3.14 Installation Method on Ubuntu

Your installation method depends on which Ubuntu release you run. Ubuntu 26.04 LTS already includes Python 3.14 in the official repositories, so APT is mainly for add-on packages such as venv, development headers, or the full standard-library bundle. Ubuntu 24.04 LTS and 22.04 LTS require the Deadsnakes PPA. Source compilation remains an option for custom builds or free-threaded (nogil) configurations on each supported release covered here.

MethodChannelPython BranchUpdatesBest For
Ubuntu 26.04 Official ReposUbuntu archive3.14.xAPT updatesUbuntu 26.04 LTS users who need venv, dev, or full add-on packages
Deadsnakes PPALaunchpad PPA3.14.xAPT-managed updatesUbuntu 24.04/22.04 LTS users who want packaged installs
Source compilationPython.org sourceLatest 3.14.xManual rebuildCustom prefixes, optimization flags, or --disable-gil builds

Protect Ubuntu’s Default Python Before Installing Python 3.14

Ubuntu packages and management tools expect the package-owned /usr/bin/python3 interpreter for that release. Replacing that symlink, using update-alternatives against /usr/bin/python3, or copying a custom interpreter over it can break tools such as add-apt-repository, command-not-found, desktop update utilities, and Python modules compiled for Ubuntu’s default ABI.

  • Use versioned commands: Run python3.14 directly, or point a project virtual environment, service file, cron job, or shebang at the versioned interpreter.
  • Keep project packages isolated: Create environments with python3.14 -m venv and install dependencies inside the activated environment. Use pipx for standalone Python CLI tools.
  • Keep source builds separate: Use make altinstall with a dedicated prefix such as /usr/local/python3.14. Do not install a custom build over /usr.
  • Do not remove the system runtime: On Ubuntu 26.04, python3.14 is the system runtime. On Ubuntu 24.04 and 22.04, Deadsnakes Python 3.14 is separate, but Ubuntu’s default python3 must stay in place.

Understand Python 3.14 Support and Compatibility on Ubuntu

  • Ubuntu 26.04 LTS uses Python 3.14 by default: Keep /usr/bin/python3 managed by Ubuntu, and install optional packages such as python3.14-venv, python3.14-dev, or python3.14-full only when your workflow needs them. Ubuntu 24.04/22.04 LTS require the Deadsnakes PPA for Python 3.14 packages.
  • Ubuntu 20.04 is not covered by the packaged paths here: It is outside standard Ubuntu support, and the documented Python 3.14 package paths target Ubuntu 26.04, 24.04, and 22.04. Upgrade the OS first when possible; otherwise use source builds only if you can own patching and dependency drift.
  • Deadsnakes PPA is community maintained: The PPA maintainer provides no guaranteed security SLA. Monitor advisories and be ready to rebuild from source if patched packages lag.
  • Ecosystem catch-up period: Some third-party wheels lag new 3.14 releases. Check project compatibility notes and run pip check after installing dependencies.
  • Free-threaded builds remain specialized: Use --disable-gil for research and benchmarking unless your workload has been validated carefully. Library compatibility varies significantly. The Deadsnakes PPA provides python3.14-nogil packages for 24.04/22.04, but Ubuntu 26.04 official repositories do not include nogil variants, so compile from source if you need a free-threaded build on 26.04.
  • Python feature releases are not Ubuntu LTS releases: Python 3.14 follows CPython’s five-year support policy. Ubuntu LTS support labels apply to the operating system release, not to every alternate interpreter you install beside it.

Python 3.14 reaches upstream end-of-life in October 2030, per the official release schedule (PEP 745). Plan migrations to Python 3.15 or newer before that date if you require ongoing security updates.

Python 3.14 Pre-Flight Checklist on Ubuntu

Before installing Python 3.14, verify your system state to avoid redundant installs or conflicts:

# Check if Python 3.14 is already installed
python3.14 --version 2>/dev/null || echo "Python 3.14 not found"

# Confirm your Ubuntu version (target LTS releases only)
lsb_release -rs

# Check available disk space (source builds need 300+ MB)
df -h /usr/local

Example output on Ubuntu 26.04 LTS (your output will show 24.04 or 22.04 if you run an older LTS):

Python 3.14.4
26.04

Disk space output will vary by system but should show free space under /usr/local:

Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       250G   40G  198G  17% /

If Python 3.14 is already installed, you can skip to the virtual environment section unless you need add-on packages, PPA packages on an older LTS release, or a source build with custom flags such as --disable-gil.

Update Ubuntu Before Installing Python 3.14

Refresh package lists and apply available updates before adding PPAs or compiling from source to avoid dependency conflicts.

Update the package index first:

sudo apt update
Reading package lists... Done

Some commands need root privileges, so use sudo where required. If your account is not in the sudoers file yet, run the commands as root or follow the guide on how to add a new user to sudoers on Ubuntu.

Optionally upgrade installed packages:

sudo apt upgrade

Install Python 3.14 on Ubuntu 26.04 LTS (Official Repositories)

Ubuntu 26.04 LTS includes Python 3.14 as the system Python and provides matching add-on packages in the official Ubuntu repositories. This is the simplest path, no PPA or compilation required.

Install the venv and development packages. Keeping python3.14 in the command is harmless on 26.04 and ensures the runtime is present on customized systems:

sudo apt install python3.14 python3.14-venv python3.14-dev

Verify the installation:

python3.14 --version
Python 3.14.4

Test that essential modules are available:

python3.14 -c "import ssl, sqlite3, bz2; print('Python 3.14 ready on Ubuntu 26.04')"
Python 3.14 ready on Ubuntu 26.04

Check the package source to confirm you are using the official Ubuntu repository:

apt-cache policy python3.14
python3.14:
  Installed: 3.14.4-1
  Candidate: 3.14.4-1
  Version table:
 *** 3.14.4-1 500
        500 http://archive.ubuntu.com/ubuntu resolute/main amd64 Packages
        100 /var/lib/dpkg/status

The Ubuntu 26.04 official repositories do not include python3.14-nogil packages. If you need free-threaded (no-GIL) builds on Ubuntu 26.04, you must compile from source with the --disable-gil flag.

Install Python 3.14 on Ubuntu 24.04 LTS and 22.04 LTS (Deadsnakes PPA)

This method applies to Ubuntu 24.04 LTS (noble) and 22.04 LTS (jammy) only. Ubuntu 26.04 LTS users should use the official repositories method above.

Install the repository helper if needed, add the Deadsnakes PPA, and refresh your package cache:

sudo apt install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
Reading package lists... Done

Confirm the PPA provides Python 3.14 packages before installing:

apt-cache policy python3.14
python3.14:
  Installed: (none)
  Candidate: 3.14.4-1+noble1
  Version table:
     3.14.4-1+noble1 500
        500 https://ppa.launchpadcontent.net/deadsnakes/ppa/ubuntu noble/main amd64 Packages

On Ubuntu 24.04 LTS, the Candidate line ends with +noble1; on Ubuntu 22.04 LTS, it ends with +jammy1.

Configure APT Pinning for Python 3.14 on Ubuntu (Advanced, Optional)

Most readers can skip APT pinning and install the explicit python3.14* packages directly. Use pinning only if you want stricter control over which packages APT may select from the Deadsnakes PPA on a mixed-use system.

cat <<EOF | sudo tee /etc/apt/preferences.d/python3.14.pref
Package: *
Pin: release o=LP-PPA-deadsnakes
Pin-Priority: 100

Package: python3.14*
Pin: release o=LP-PPA-deadsnakes
Pin-Priority: 700
EOF

This creates a two-rule pinning configuration. The first rule deprioritizes all PPA packages, and the second rule prefers only python3.14* packages.

Install Python 3.14 packages:

sudo apt install python3.14 python3.14-venv python3.14-dev

The maintainer states there is no guarantee of timely security updates. Production systems must track CVEs and be ready to recompile or sandbox workloads until patches arrive. Use the PPA for development, CI, or testing and rely on Ubuntu’s default Python for system tooling. Monitor the Python Security Response Team page and the CVE.org search for Python for vulnerabilities. Subscribe to the Python Security Announcements mailing list to receive notifications when security patches are released.

Python 3.14 Availability: The Deadsnakes PPA publishes packages for Ubuntu 24.04 LTS (noble) and 22.04 LTS (jammy) only. Patch releases can lag upstream, so use the source build method if you need a newer point release before packaged builds appear.

Verify the installation:

python3.14 --version
Python 3.14.4

Your output will show the current 3.14.x point release available from the PPA.

Complete PPA Installation Example on Ubuntu 24.04

On a fresh Ubuntu 24.04 LTS system, the full packaged install path is:

sudo apt install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install python3.14 python3.14-venv python3.14-dev
The following NEW packages will be installed:
  python3.14 python3.14-dev python3.14-venv

Next, verify the installation and test essential modules (package version strings will move to newer 3.14.x point releases over time):

python3.14 -c "import ssl, sqlite3, bz2; print('Python 3.14 ready on Ubuntu')"
Python 3.14 ready on Ubuntu

Install Additional Python 3.14 Packages on Ubuntu (Optional)

Both the Ubuntu 26.04 official repositories and the Deadsnakes PPA provide additional Python 3.14 packages. Some optional Ubuntu 26.04 packages, including python3.14-venv and python3.14-full, come from the Universe component, so enable Universe first if a customized system cannot locate them.

Debugging symbols for profiling and crash analysis:

sudo apt install python3.14-dbg

GNU dbm bindings for the dbm.gnu module:

sudo apt install python3.14-gdbm

Tkinter GUI support for graphical applications. If you also want the IDLE development environment, see how to install IDLE Python on Ubuntu:

sudo apt install python3.14-tk

Example scripts for documentation and quick functionality checks:

sudo apt install python3.14-examples

Free-Threaded Python 3.14 (No-GIL) Packages (Deadsnakes PPA Only)

The Deadsnakes PPA for Ubuntu 24.04/22.04 includes free-threaded runtime packages that let you test no-GIL builds without compiling from source. These packages are not available in the Ubuntu 26.04 official repositories.

Install the free-threaded runtime:

sudo apt install python3.14-nogil python3.14-gdbm-nogil

The free-threaded binary installs as python3.14t. Verify it is available:

python3.14t -VV
Python 3.14.4 free-threading build

Ubuntu 26.04 LTS users: If you need the free-threaded runtime, you must compile Python 3.14 from source with the --disable-gil configure flag. Use python3.14t -V or -VV for version checks because --version is not supported by the free-threaded binary in current Deadsnakes builds.

Install python3.14-full Meta-Package on Ubuntu

Both the Ubuntu 26.04 official repos and the Deadsnakes PPA include a python3.14-full meta-package that bundles a complete set of standard library modules similar to Ubuntu’s system interpreter:

sudo apt install python3.14-full

For Ubuntu 24.04/22.04 LTS (Deadsnakes PPA), you can also include the no-GIL variants:

sudo apt install python3.14-full python3.14-nogil python3.14-gdbm-nogil

Compile Python 3.14 from Source on Ubuntu

Source compilation is useful when you need custom build flags (like --disable-gil for free-threaded builds), a custom installation prefix, or profile-guided optimizations beyond what packaged builds offer. This method works on Ubuntu 26.04, 24.04, and 22.04.

Download Python 3.14 Source Tarball on Ubuntu

Download the latest stable 3.14.x release from python.org and extract it in a reusable user-owned workspace. This version lookup reads the stable source releases page instead of the raw FTP directory, which prevents release-candidate directories from being selected before a final point release is published.

Install baseline download utilities if they are missing on minimal images:

sudo apt install python3 wget ca-certificates
mkdir -p "$HOME/python3.14-source-build"
cd "$HOME/python3.14-source-build"

PY314_VERSION="$(python3 - <<'PY'
import re
from urllib.request import urlopen

html = urlopen("https://www.python.org/downloads/source/", timeout=20).read().decode()
stable = html.split("Pre-releases", 1)[0]
versions = sorted(
    set(re.findall(r"Python (3\.14\.\d+) -", stable)),
    key=lambda version: tuple(map(int, version.split("."))),
)
print(versions[-1] if versions else "")
PY
)" || { echo "Failed to fetch Python version"; exit 1; }
[ -z "$PY314_VERSION" ] && { echo "No 3.14.x version found"; exit 1; }

echo "Using Python ${PY314_VERSION}"
rm -rf "Python-${PY314_VERSION}"
wget "https://www.python.org/ftp/python/${PY314_VERSION}/Python-${PY314_VERSION}.tar.xz" || exit 1
tar -xf Python-${PY314_VERSION}.tar.xz
cd Python-${PY314_VERSION}
Using Python 3.14.4

If discovery fails or your host is air-gapped, visit the Python.org downloads page to find the latest stable 3.14.x release and substitute the version number manually. The script exits with an error message rather than silently proceeding with missing versions.

Install Python 3.14 Build Dependencies on Ubuntu

Install libraries needed for SSL, compression, readline, Tk, and UUID support:

sudo apt install build-essential zlib1g-dev libncurses-dev libgdbm-dev libgdbm-compat-dev \
libnss3-dev libssl-dev libsqlite3-dev libreadline-dev libffi-dev libbz2-dev liblzma-dev \
uuid-dev libexpat1-dev tk-dev pkg-config make libzstd-dev

These package names work on Ubuntu 26.04 LTS, 24.04 LTS, and 22.04 LTS. The libzstd-dev package enables the new _zstd compression module introduced in Python 3.14.

Configure and Build Python 3.14 on Ubuntu

The --prefix flag installs everything under /usr/local/python3.14 instead of the default /usr/local, keeping the build separate from the system interpreter. This release-build configuration avoids the longer profile-guided optimization test stage, which can fail on otherwise healthy systems:

./configure --with-ensurepip=install --prefix=/usr/local/python3.14
make -j"$(nproc)"
sudo make altinstall
configure: creating Makefile

To evaluate the free-threaded runtime, add --disable-gil to the configure command. This experimental build is intended for testing and benchmarking, not production.

make altinstall keeps /usr/bin/python3 untouched while adding /usr/local/python3.14/bin/python3.14.

Register Libraries and Test the Python 3.14 Build on Ubuntu

Afterward, point the dynamic linker at your custom installation, refresh the cache, and add a convenience symlink:

echo '/usr/local/python3.14/lib' | sudo tee /etc/ld.so.conf.d/python3.14.conf
sudo ldconfig
sudo ln -sf /usr/local/python3.14/bin/python3.14 /usr/local/bin/python3.14

Verify the build and ensure critical modules compiled successfully:

python3.14 --version
python3.14 -c "import ssl, sqlite3, bz2, compression.zstd; print('Source build is healthy')"
Python 3.14.4
Source build is healthy

Your output will show the specific 3.14.x version you compiled from source.

If the second command fails, install missing -dev packages, rerun ./configure, and rebuild.

Install Pip for Python 3.14 on Ubuntu

Pip behavior differs by installation method on Ubuntu. The official Ubuntu 26.04 python3.14 package disables ensurepip outside virtual environments, while Deadsnakes and source builds can bootstrap pip directly. For broader pip workflows, see how to install pip on Ubuntu.

Bootstrap Python 3.14 pip via ensurepip on Ubuntu

Keep pip scoped to Python 3.14 instead of the system interpreter. Deadsnakes PPA installs require the python3.14-venv package (which provides ensurepip). Source builds can skip the APT step if you configured --with-ensurepip=install.

On Ubuntu 26.04 official repository builds, python3.14 -m ensurepip is disabled. Use a Python 3.14 virtual environment for normal project work, or use get-pip.py only for custom builds and staged bootstrap workflows.

ensurepip is disabled in Debian/Ubuntu for the system python.

Python modules for the system python are usually handled by dpkg and apt-get.
# Deadsnakes PPA installs only
sudo apt install python3.14-venv

# Deadsnakes PPA or source builds
python3.14 -m ensurepip --upgrade
python3.14 -m pip --version

Source builds display the /usr/local/ prefix in the output. The exact pip version changes over time:

pip 26.x from /usr/local/python3.14/lib/python3.14/site-packages/pip (python 3.14)

Deadsnakes PPA installs can default to your user site because the Python 3.14 site-packages directory is not writable by a normal user:

Defaulting to user installation because normal site-packages is not writeable
pip 26.x from /home/joshua/.local/lib/python3.14/site-packages/pip (python 3.14)

ensurepip installs pip for the Python 3.14 interpreter you call, not Ubuntu’s default python3. If your build was configured without ensurepip, or you are using Ubuntu’s official 26.04 package, create a virtual environment to get pip and keep packages isolated:

python3.14 -m venv ~/venvs/py314-base
source ~/venvs/py314-base/bin/activate
pip --version
pip 26.x from /home/ubuntu/venvs/py314-base/lib/python3.14/site-packages/pip (python 3.14)

Bootstrap Python 3.14 pip with get-pip.py on Ubuntu

For custom builds, or for hosts where you have staged the bootstrap script manually, run get-pip.py with Python 3.14. Prefer virtual environments for normal Ubuntu systems.

wget https://bootstrap.pypa.io/get-pip.py
python3.14 get-pip.py
rm get-pip.py
Collecting pip
Installing collected packages: pip
Successfully installed pip-26.x

This installs pip and may also install bundled packaging components depending on the current bootstrap script behavior for Python 3.14. Download a fresh copy each time you repeat the process.

Manage Packages with python3.14 -m pip on Ubuntu

Inside an activated virtual environment, invoke pip through the versioned interpreter to avoid cross-version conflicts:

python3.14 -m pip install package_name
python3.14 -m pip install --upgrade package_name
python3.14 -m pip uninstall package_name

Swap package_name with libraries such as numpy, fastapi, or django.

Ubuntu 24.04 LTS and 26.04 LTS mark the system Python (python3) as externally managed (see PEP 668). If you run python3 -m pip install <package>, pip blocks system-wide installs unless you use a virtual environment or pass --break-system-packages. Deadsnakes python3.14 installs usually default to a user-site pip path instead of triggering the externally managed error, but virtual environments are still the safest choice for repeatable project setups. Use --break-system-packages only when you fully understand the risks: it allows pip to write into system directories and can break apt upgrades or system utilities.

Work in Python 3.14 Virtual Environments on Ubuntu

Virtual environments isolate dependencies per project. For expanded workflows, see how to create a Python virtual environment on Ubuntu.

Create a Python 3.14 Virtual Environment on Ubuntu

Choose a directory for environments (for example ~/venvs) and create one with Python 3.14:

python3.14 -m venv ~/venvs/py314

Replace ~/venvs/py314 with any path that fits your workflow.

Activate the Python 3.14 Virtual Environment on Ubuntu

Activate the environment so python and pip point to the local interpreter:

source ~/venvs/py314/bin/activate
(py314) user@ubuntu:~$

The shell prompt updates with the environment name, indicating activation.

Deactivate the Python 3.14 Virtual Environment on Ubuntu

When finished, run:

deactivate

This returns the shell to the system Python context.

Troubleshooting Common Python 3.14 Installation Issues on Ubuntu

Missing Development Headers During Python 3.14 Compilation on Ubuntu

If configure reports disabled modules for SSL, bz2, or sqlite, identify missing dependencies and reinstall them. Review the configure output directly:

./configure --with-ensurepip=install --prefix=/usr/local/python3.14 2>&1 | grep "disabled"

Example output showing disabled modules:

The following modules have been disabled:
_hashlib _ssl
_bz2
_sqlite3
nis ossaudiodev

Some modules like nis and ossaudiodev are deprecated and safe to ignore. If _zstd appears missing, install libzstd-dev and reconfigure. The _zstd module is new in Python 3.14 and optional unless your code uses Zstandard compression.

Install the corresponding development headers and reconfigure:

sudo apt install libssl-dev libbz2-dev libsqlite3-dev
./configure --with-ensurepip=install --prefix=/usr/local/python3.14
make -j"$(nproc)"
sudo make altinstall

Verify all modules loaded correctly after rebuild:

python3.14 -c "import ssl, sqlite3, bz2, compression.zstd; print('All modules present')"
All modules present

Shared Library Linking Errors for Source-Built Python 3.14 on Ubuntu

If python3.14 reports error while loading shared libraries: libpython3.14.so.1.0: cannot open shared object file, verify the library path and refresh the linker cache.

Example error message:

/usr/local/python3.14/bin/python3.14: error while loading shared libraries: libpython3.14.so.1.0: cannot open shared object file (No such file or directory)

Locate the library:

find /usr/local -name "libpython3.14.so*"
/usr/local/python3.14/lib/libpython3.14.so.1.0
/usr/local/python3.14/lib/libpython3.14.so

Update the linker cache for the custom prefix:

sudo ldconfig /usr/local/python3.14/lib

Or register the specific prefix for persistent library loading:

echo "/usr/local/python3.14/lib" | sudo tee /etc/ld.so.conf.d/python3.14.conf
sudo ldconfig

Verify the interpreter now loads correctly:

/usr/local/python3.14/bin/python3.14 --version
Python 3.14.4

Pip Externally Managed Environment Errors on Ubuntu

On Ubuntu 24.04 LTS and 26.04 LTS, pip blocks installs to Ubuntu’s system interpreter (python3) without a virtual environment. On Ubuntu 26.04, that system interpreter is Python 3.14. Deadsnakes python3.14 installs on 24.04/22.04 usually default to a user-site pip path instead, but virtual environments remain the recommended approach.

error: externally-managed-environment

X This environment is externally managed
-> To install Python packages system-wide, try apt install
   xyz, where xyz is the package you are trying to
   install.

If you wish to install a Python package using pip, you must
create a virtual environment first.

Create a venv instead of bypassing protections:

python3 -m venv myproject_env
source myproject_env/bin/activate
pip install package-name

For CLI tools you want available system-wide, pipx provides isolated environments automatically. Install it with sudo apt install pipx, then use pipx install package-name to install tools without manually creating virtual environments.

Only use --break-system-packages in disposable environments. It tells pip to ignore Ubuntu’s package boundary and can leave apt-managed Python modules in a broken state:

python3 -m pip install --break-system-packages package-name

Unable to Locate Package python3.14 on Ubuntu 24.04 or 22.04

If sudo apt install python3.14 fails on Ubuntu 24.04 or 22.04, the Deadsnakes PPA was not added, apt update was skipped, or the PPA entry is disabled.

E: Unable to locate package python3.14

Fix it by adding the PPA, refreshing package metadata, and verifying the package source before installing:

sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
apt-cache policy python3.14
python3.14:
  Candidate: 3.14.4-1+noble1
  Version table:
     3.14.4-1+noble1 500
        500 https://ppa.launchpadcontent.net/deadsnakes/ppa/ubuntu noble/main amd64 Packages

Ubuntu 26.04 LTS users do not need the PPA for python3.14. If you add the Deadsnakes PPA on 26.04, apt update fails because the PPA does not publish a resolute repository.

APT and System Tool Errors After Replacing Ubuntu’s Default Python

If add-apt-repository, command-not-found, desktop update tools, or other Python-based Ubuntu utilities fail after Python changes, check whether the system /usr/bin/python3 symlink was modified. It should point to Ubuntu’s package-owned default interpreter, not a manually installed Python 3.14 binary on 24.04 or 22.04.

Check the symlink:

ls -la /usr/bin/python3
lrwxrwxrwx 1 root root 10 Nov 12 12:15 /usr/bin/python3 -> python3.12

On Ubuntu 22.04 LTS the symlink points to python3.10, on Ubuntu 24.04 LTS it points to python3.12, and on Ubuntu 26.04 LTS it points to python3.14.

Restore the package-owned symlink if needed:

sudo apt install --reinstall python3-minimal python3-apt python3-distro-info
ls -la /usr/bin/python3

Always call Python 3.14 explicitly with python3.14 on Ubuntu 24.04/22.04 instead of altering system links. Do not use update-alternatives to manage /usr/bin/python3. On Ubuntu 26.04, python3 already points to Python 3.14 through Ubuntu’s packaged default.

Python 3.14 Virtual Environment Creation Fails on Ubuntu

If python3.14 -m venv reports that ensurepip is unavailable, the venv module is missing for that Python 3.14 install. Install the python3.14-venv package for Ubuntu repository or Deadsnakes installs, or confirm --with-ensurepip=install for source builds.

Example error:

Error: ensurepip is not available in this environment.

For PPA installations, install the venv module:

sudo apt install python3.14-venv
python3.14 -m venv myenv
source myenv/bin/activate
(myenv) user@ubuntu:~$

For source builds, verify --with-ensurepip=install was specified during configure, or bootstrap pip via get-pip.py as an alternative.

Update or Remove Python 3.14 on Ubuntu

Update Python 3.14 Packages on Ubuntu

sudo apt update
sudo apt install --only-upgrade python3.14 python3.14-venv python3.14-dev

If you installed optional packages (such as python3.14-nogil or python3.14-tk), add them to the upgrade command.

Update Source-Compiled Python 3.14 on Ubuntu

This updater rebuilds the latest 3.14.x release when you installed from source:

#!/usr/bin/env bash
set -e

INSTALL_PREFIX="/usr/local/python3.14"
BUILD_DIR="$HOME/python3.14-source-build"
LOG_FILE="$BUILD_DIR/update.log"
PY314_BIN="$INSTALL_PREFIX/bin/python3.14"

for cmd in gcc make python3 wget tar; do
    if ! command -v "$cmd" >/dev/null 2>&1; then
        echo "Error: $cmd is required but not installed."
        echo "Run the source-build dependency command from this article, then retry."
        exit 1
    fi
done

if [ ! -x "$PY314_BIN" ]; then
    echo "Error: $PY314_BIN not found."
    echo "Install Python 3.14 from source before running this update script."
    exit 1
fi

mkdir -p "$BUILD_DIR"

CURRENT_VERSION="$("$PY314_BIN" --version | awk '{print $2}')"
LATEST_VERSION="$(python3 - <<'PY'
import re
from urllib.request import urlopen

html = urlopen("https://www.python.org/downloads/source/", timeout=20).read().decode()
stable = html.split("Pre-releases", 1)[0]
versions = sorted(
    set(re.findall(r"Python (3\.14\.\d+) -", stable)),
    key=lambda version: tuple(map(int, version.split("."))),
)
print(versions[-1] if versions else "")
PY
)"

if [ -z "$LATEST_VERSION" ]; then
    echo "Error: Could not fetch the latest Python 3.14.x version."
    exit 1
fi

echo "Current version: $CURRENT_VERSION"
echo "Latest version:  $LATEST_VERSION"

if [ "$CURRENT_VERSION" = "$LATEST_VERSION" ]; then
    echo "Already up to date."
    exit 0
fi

cd "$BUILD_DIR"

rm -rf "Python-${LATEST_VERSION}" "Python-${LATEST_VERSION}.tar.xz"
wget "https://www.python.org/ftp/python/${LATEST_VERSION}/Python-${LATEST_VERSION}.tar.xz"
tar -xf "Python-${LATEST_VERSION}.tar.xz"
rm "Python-${LATEST_VERSION}.tar.xz"

cd "Python-${LATEST_VERSION}"
./configure --with-ensurepip=install --prefix="$INSTALL_PREFIX"
make -j"$(nproc)"
sudo make altinstall

NEW_VERSION="$("$PY314_BIN" --version | awk '{print $2}')"
echo "$(date): Updated to $NEW_VERSION" >> "$LOG_FILE"
echo "Successfully updated to $NEW_VERSION"

Avoid automating this with cron. Compilation can fail due to missing dependencies, failed tests, or network issues. Always run the script manually so you can monitor the output and address problems before they affect your system.

Verify the updated version after the script completes:

/usr/local/python3.14/bin/python3.14 --version
Python 3.14.4

Remove Python 3.14 Packages on Ubuntu

Ubuntu 26.04 LTS uses Python 3.14 as the system interpreter. Do not remove python3.14, libpython3.14-stdlib, or the /usr/bin/python3 symlink on Ubuntu 26.04. On Ubuntu 24.04/22.04, Deadsnakes Python 3.14 is separate from the system interpreter and can be removed when you no longer need it.

On Ubuntu 26.04, remove only optional add-on packages you installed. Leave the core runtime in place:

sudo apt remove python3.14-venv python3.14-dev python3.14-full python3.14-tk python3.14-examples python3.14-gdbm

Confirm Python still works after removing optional add-ons:

python3 --version
python3.14 --version
Python 3.14.4
Python 3.14.4

On Ubuntu 24.04/22.04, remove the Deadsnakes packages when you no longer need them:

sudo apt remove python3.14 python3.14-venv python3.14-dev python3.14-full python3.14-nogil python3.14-gdbm-nogil

Preview dependency cleanup before running autoremove. Continue only if the listed packages are no longer needed on your system:

sudo apt autoremove --dry-run
sudo apt autoremove

Verify no installed Deadsnakes Python 3.14 packages remain:

dpkg-query -W -f='${db:Status-Abbrev} ${binary:Package}\n' 'python3.14*' 2>/dev/null | grep '^ii' || echo "No installed python3.14 packages remain"
No installed python3.14 packages remain

Remove the Deadsnakes PPA (Ubuntu 24.04/22.04 Only)

If you installed Python 3.14 from the Deadsnakes PPA on Ubuntu 24.04 or 22.04, remove the repository and pin file. Skip this step on Ubuntu 26.04 because that release uses the official repositories:

sudo add-apt-repository --remove ppa:deadsnakes/ppa
sudo rm -f /etc/apt/preferences.d/python3.14.pref
sudo apt update
apt-cache madison python3.14 | grep deadsnakes || echo "No Deadsnakes python3.14 candidate found"
No Deadsnakes python3.14 candidate found

Clean Up Source-Compiled Python 3.14 Installations on Ubuntu

Remove source installs and related linker entries if you compiled Python 3.14 manually.

The following commands permanently delete the source-compiled Python 3.14 installation, including all modules and libraries under /usr/local/python3.14, plus the reusable build workspace at ~/python3.14-source-build. Virtual environments created with this interpreter will stop working. Back up anything you need first, for example cp -r /usr/local/python3.14 ~/python3.14-backup.

sudo rm -f /usr/local/bin/python3.14
sudo rm -rf /usr/local/python3.14
sudo rm -f /etc/ld.so.conf.d/python3.14.conf
rm -rf "$HOME/python3.14-source-build"
sudo ldconfig
ls -ld /usr/local/python3.14
ls: cannot access '/usr/local/python3.14': No such file or directory

Adjust the path if you used a custom prefix such as /opt/python3.14.

Compare Python Versions on Ubuntu (Reference)

Use this reference section if you are deciding whether Python 3.14 is the right target for your workload or comparing it against older Ubuntu-friendly Python versions.

Python VersionAvailability on UbuntuChoose It WhenTrade-offs
Install Python 3.8 on UbuntuDeadsnakes PPA or source build onlyLegacy applications pinned to EOL runtimes, compatibility testing, transitional migrationsEnd-of-life October 2024, no upstream security fixes, container isolation recommended
Install Python 3.10 on UbuntuUbuntu 22.04 LTS default, Deadsnakes PPA for 24.04 LTSConservative projects that still target Python 3.10Older feature set, many libraries optimize for 3.11+, PPA required on 24.04 LTS
Install Python 3.11 on UbuntuDeadsnakes PPA for 24.04/22.04, source builds on 26.04CPU-bound workloads needing major speed gains and precise error locationsCommunity-maintained packages only, not default on supported Ubuntu LTS releases
Install Python 3.12 on UbuntuUbuntu 24.04 LTS default, Deadsnakes PPA for 22.04 LTSGeneral-purpose development on Ubuntu 24.04 or compatibility testing on 22.04Ubuntu 22.04 LTS requires PPA, fewer concurrency enhancements than newer releases
Install Python 3.13 on UbuntuDeadsnakes PPA for 24.04/22.04, source builds on 26.04Teams validating newer optimizations with support through October 2029Community packages lack guaranteed security SLAs; source builds need manual updates
Python 3.14Ubuntu 26.04 LTS default and official repos, Deadsnakes PPA for 24.04/22.04, source builds for custom needsProjects validating the newest interpreter changes with support through October 2030Default on 26.04 only; PPA packages on 24.04/22.04 are community maintained; some wheels may lag new point releases

Ubuntu’s default Python remains the safest choice for system tooling and long-lived hosts managed primarily through APT. On Ubuntu 26.04 that default is Python 3.14; on Ubuntu 24.04 and 22.04, keep Python 3.14 isolated with versioned binaries and virtual environments.

Python 3.14 References for Ubuntu

Reference these resources while working with Python 3.14 on Ubuntu:

Conclusion

Python 3.14 is now available through the correct channel for your Ubuntu release, with pip kept inside virtual environments and a clear upgrade path for future 3.14.x point releases. For expanded package management workflows, install pip on Ubuntu. To manage isolated dependency sets for each project, create a Python virtual environment on Ubuntu.

Share this guide

Help another Linux user troubleshoot faster

Share this guide with someone troubleshooting Linux systems or saving it for later.

Follow LinuxCapable

Want more LinuxCapable guides in Google?

Add LinuxCapable as a preferred source so Google can show more of our fresh Linux tutorials in Top Stories and From your sources when relevant.

Add LinuxCapable as a preferred source on Google
Search LinuxCapable

Need another guide?

Search LinuxCapable for package installs, commands, troubleshooting, and follow-up guides related to what you just read.

Found this guide useful?

Support LinuxCapable to keep tutorials free and up to date.

Buy me a coffeeBuy me a coffee
Before commenting, please review our Comments Policy.
Formatting tips for your comment

You can use basic HTML to format your comment. Useful tags currently allowed in published comments:

You type Result
<code>command</code> command
<strong>bold</strong> bold
<em>italic</em> italic
<blockquote>quote</blockquote> quote block

Got a Question or Feedback?

We read and reply to every comment - let us know how we can help or improve this guide.

Let us know you are human: