How to Install Python 3.14 on Ubuntu (26.04, 24.04, 22.04)

Last updated Friday, February 27, 2026 11:57 am 21 min read

Python 3.14 brings a new JIT compiler, deferred evaluation of annotations, and the experimental free-threaded (no-GIL) build option for parallel workloads. To install Python 3.14 on Ubuntu, you add it alongside the system interpreter so apt and OS tooling keep working without conflicts.

Ubuntu 26.04 LTS ships Python 3.14 in its official repositories, so a single apt install is all you need. On Ubuntu 24.04 LTS and 22.04 LTS the package comes from the Deadsnakes PPA, and source compilation is available on any release for custom or free-threaded builds. The walkthrough below covers every path, plus pip, virtual environments, troubleshooting, updates, and clean removal.

Choose How to Install Python 3.14 on Ubuntu

Python 3.14 Installation Method Comparison

Your installation method depends on which Ubuntu release you run. Ubuntu 26.04 LTS includes Python 3.14 in the official repositories, so a standard APT install is all you need. 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 any release.

MethodChannelVersionUpdatesBest For
Ubuntu 26.04 Official ReposUbuntu archive3.14.xAPT updatesUbuntu 26.04 LTS users (simplest path)
Deadsnakes PPALaunchpad PPALatest 3.14.xAPT 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

Never replace /usr/bin/python3 or uninstall the system interpreter. Use versioned binaries like python3.14 and virtual environments for isolation.

Understand Python 3.14 Support and Compatibility on Ubuntu

  • Ubuntu 26.04 LTS includes Python 3.14: Canonical provides packaged updates through the official repositories. Ubuntu 24.04/22.04 LTS require the Deadsnakes PPA.
  • 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 experimental: Use --disable-gil for research and benchmarking, not production workloads. Library compatibility varies significantly. The Deadsnakes PPA provides python3.14-nogil packages for 24.04/22.04, but Ubuntu 26.04 official repos do not include nogil variants, compile from source if you need free-threaded builds on 26.04.

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.

Install Python 3.14 on Ubuntu

Choose the installation method that matches your Ubuntu release. Ubuntu 26.04 LTS includes Python 3.14 in the official repositories. Ubuntu 24.04 LTS and 22.04 LTS require the Deadsnakes PPA. Source compilation is available on all releases for custom builds.

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 already present" || echo "Python 3.14 not found, safe to install"

# 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 not found, safe to install
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 “Work in Python 3.14 Virtual Environments on Ubuntu” section unless you need to rebuild with custom flags (like --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
Hit:1 http://archive.ubuntu.com/ubuntu resolute InRelease
Reading package lists... Done

This guide uses sudo for commands that need root privileges. 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 in the official Ubuntu repositories. This is the simplest installation path, no PPA or compilation required.

Install Python 3.14 with the venv and development packages:

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

Verify the installation:

python3.14 --version
Python 3.14.3

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.3-1
  Candidate: 3.14.3-1
  Version table:
 *** 3.14.3-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.

Add the Deadsnakes PPA and refresh your package cache:

sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
Get:1 https://ppa.launchpadcontent.net/deadsnakes/ppa/ubuntu noble InRelease [18.1 kB]
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.3-1+noble1
  Version table:
     3.14.3-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 immediately.

Verify the installation:

python3.14 --version
Python 3.14.3

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

Full PPA Installation Example Walkthrough: On a fresh Ubuntu 24.04 LTS system, here is what a complete installation looks like:

sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
sudo apt install python3.14 python3.14-venv python3.14-dev
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
python3.14 is already the newest version (3.14.3-1+noble1).
Setting up python3.14-dev (3.14.3-1+noble1) ...
Setting up python3.14-venv (3.14.3-1+noble1) ...
Processing triggers for man-db (2.12.0-4build2) ...
Done.

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. Install what you need based on your use case.

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.3 free-threading build (main, Feb  4 2026, 09:28:29) [GCC 13.3.0]

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 all Ubuntu LTS releases.

Download Python 3.14 Source Tarball on Ubuntu

Download the latest 3.14.x release from python.org and extract it. The snippet below uses curl to discover the newest patch version automatically:

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

sudo apt install curl wget ca-certificates
PY314_VERSION="$(curl -fsSL https://www.python.org/ftp/python/ | grep -oE '3\.14\.[0-9]+' | sort -V | tail -1)" || { 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}"
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.3

If discovery fails or your host is air-gapped, visit the Python.org downloads page to find the latest 3.14.x release and substitute the version number manually. The script will exit 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

Profile-guided optimization (--enable-optimizations) and link-time optimization (--with-lto) produce a faster interpreter. The --prefix flag installs everything under /usr/local/python3.14 instead of the default /usr/local, keeping the build separate from the system interpreter:

./configure --enable-optimizations --with-lto --with-ensurepip=install --prefix=/usr/local/python3.14
make -j"$(nproc)"
sudo make altinstall
checking for stdlib extension module _sqlite3... yes
checking for stdlib extension module _bz2... yes
checking for stdlib extension module _zstd... yes
checking for stdlib extension module _ssl... yes
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 -s /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; print('Source build is healthy')"
Python 3.14.3
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 (recommended) or the get-pip.py fallback section below if you need a standalone pip bootstrap.

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:

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

Deadsnakes PPA installs often 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 25.3 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 25.3 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 air-gapped hosts or custom builds, download the bootstrap script and run it with Python 3.14:

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-25.3

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

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 --enable-optimizations --with-lto --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 --enable-optimizations --with-lto --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; 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.3

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. Deadsnakes python3.14 installs 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:

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.3-1+noble1
  Version table:
     3.14.3-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.

Python 3.14 APT Errors After Adding the Deadsnakes PPA on Ubuntu

If apt errors mention Python after adding the Deadsnakes PPA, ensure you did not modify the system /usr/bin/python3 symlink. It should point to Ubuntu’s default interpreter.

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 26.04 LTS it points to python3.13.

Restore it if needed:

# Ubuntu 26.04 LTS
sudo ln -sf /usr/bin/python3.13 /usr/bin/python3

# Ubuntu 24.04 LTS
sudo ln -sf /usr/bin/python3.12 /usr/bin/python3

# Ubuntu 22.04 LTS
sudo ln -sf /usr/bin/python3.10 /usr/bin/python3

Always call Python 3.14 explicitly with python3.14 instead of altering system links.

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

Use the script below to rebuild 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="/usr/local/src/python3.14-build"
LOG_FILE="$BUILD_DIR/update.log"
PY314_BIN="$INSTALL_PREFIX/bin/python3.14"

for cmd in gcc make curl wget tar; do
    if ! command -v "$cmd" >/dev/null 2>&1; then
        echo "Error: $cmd is required but not installed."
        echo "Run: sudo apt install build-essential curl wget"
        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

CURRENT_VERSION="$("$PY314_BIN" --version | awk '{print $2}')"
LATEST_VERSION="$(curl -fsSL https://www.python.org/ftp/python/ | grep -oE '3\\.14\\.[0-9]+' | sort -V | tail -1)"

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

sudo install -d -m 0755 "$BUILD_DIR"
sudo chown "$USER":"$USER" "$BUILD_DIR"
cd "$BUILD_DIR"

rm -rf Python-*/
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 --enable-optimizations --with-lto --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.3

Remove Python 3.14 Packages on Ubuntu

Python 3.14 is not the system interpreter on Ubuntu 26.04 LTS, 24.04 LTS, or 22.04 LTS. Removing it will not break apt as long as you leave /usr/bin/python3 unchanged. Verify your release before removal.

Remove Python 3.14 if you no longer need it. The same commands work whether you installed from Ubuntu 26.04’s official repositories or the Deadsnakes PPA on Ubuntu 24.04/22.04:

sudo apt remove --purge python3.14 python3.14-venv python3.14-dev
sudo apt autoremove

Confirm your Ubuntu version before removal:

lsb_release -rs
24.04

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 since you installed from 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 policy python3.14
python3.14:
  Installed: (none)
  Candidate: (none)

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 any build files in /usr/local/src/python3.14-build if you used the update script. 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
sudo rm -rf /usr/local/src/python3.14-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 UbuntuDeadsnakes PPA for 24.04 LTS, Ubuntu 22.04 LTS defaultConservative production fleets targeting Canonical coverage through October 2026Older 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 any supported Ubuntu release
Install Python 3.12 on UbuntuUbuntu 24.04 LTS default, Deadsnakes PPA for 22.04 LTSGeneral-purpose development with Canonical-managed security updates through October 2028Ubuntu 22.04 LTS requires PPA, fewer concurrency enhancements than newer releases
Install Python 3.13 on UbuntuUbuntu 26.04 LTS default, Deadsnakes PPA for 24.04/22.04Teams validating newer optimizations with support through October 2029Community packages lack guaranteed security SLAs; some wheels lag initial releases
Python 3.14Ubuntu 26.04 LTS official repos, Deadsnakes PPA for 24.04/22.04, source builds for custom needsEarly adopters validating the newest interpreter changes with support through October 2030Not default on any release, PPA updates may trail upstream, ecosystem wheels may take time to catch up

Ubuntu’s default Python remains the safest choice for system tooling and long-lived hosts managed primarily through APT. Use Python 3.14 when you need newer language behavior, interpreter testing, or project-specific environments, and keep it isolated with versioned binaries and virtual environments.

Frequently Asked Questions

Why does apt say “Unable to locate package python3.14” on Ubuntu 24.04 or 22.04?

Ubuntu 24.04 and 22.04 do not include python3.14 in their default repositories, so apt cannot find the package until you add the Deadsnakes PPA and run apt update. Ubuntu 26.04 includes Python 3.14 in the official repositories, so the same command works there without a PPA.

Can I have multiple Python versions installed at the same time?

Yes. Ubuntu supports running multiple Python interpreters simultaneously. Install Python 3.14 via the PPA, official repos (26.04), or source compilation alongside your default python3. Call each version explicitly (python3.14, python3.12, python3.10) and use virtual environments to isolate project dependencies. Never modify the /usr/bin/python3 symlink since Ubuntu system tools depend on it.

Is Python 3.14’s free-threaded mode ready for production use?

No. The free-threaded (no-GIL) build enabled by --disable-gil remains experimental in Python 3.14. PEP 703 introduced this as an opt-in feature for testing and benchmarking parallel workloads. Many C extensions and libraries have not been updated for thread safety without the GIL. Use free-threaded builds for research and performance experiments, not production applications.

Why does pip show externally-managed-environment on Ubuntu 24.04 or 26.04?

Ubuntu 24.04 and 26.04 protect the system python3 environment under PEP 668, so pip blocks direct installs into system-managed directories. Use a virtual environment with python3.14 -m venv for project packages, or use pipx for CLI tools. Avoid --break-system-packages unless you accept the risk of breaking apt-managed Python packages.

What is the default Python version on each Ubuntu LTS release?

Ubuntu 26.04 LTS defaults to Python 3.14. Ubuntu 25.04 ships Python 3.13. Ubuntu 24.04 LTS ships Python 3.12. Ubuntu 22.04 LTS ships Python 3.10. To run Python 3.14 on releases older than 26.04, add the Deadsnakes PPA or compile from source.

Can I install Python 3.14 on Ubuntu 20.04?

Ubuntu 20.04 LTS reached end of standard support in April 2025. The Deadsnakes PPA may still publish Python 3.14 packages for 20.04, but the maintainer focuses on supported releases (24.04 and 22.04). Upgrade to Ubuntu 24.04 LTS or 26.04 LTS before adding new Python interpreters.

How do I upgrade from an older Python version to Python 3.14 on Ubuntu?

You do not upgrade in place. Install Python 3.14 alongside your existing interpreter using the Deadsnakes PPA, Ubuntu 26.04 official repos, or source compilation. Call it with python3.14 and move projects into python3.14 virtual environments. The system python3 stays on its original version so apt and OS tools are unaffected.

Is Python 3.14 an LTS release?

Python itself does not use LTS labels. Every CPython feature release (3.12, 3.13, 3.14) receives five years of upstream support: roughly two years of active bug fixes followed by three years of security-only patches. Python 3.14 is supported through October 2030 per PEP 745. The LTS label applies to Ubuntu releases (22.04 LTS, 24.04 LTS, 26.04 LTS), not to Python versions.

Python 3.14 References for Ubuntu

Reference these resources while working with Python 3.14 on Ubuntu:

Conclusion

Python 3.14 is running alongside Ubuntu’s default interpreter, with pip available 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.

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 coffee Buy 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:

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

Leave a Comment

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

Let us know you are human: