If sudo apt install python3 reports that Python is already the newest package, but python3 --version still shows 3.10 on Ubuntu 22.04 or 3.12 on Ubuntu 24.04, you are seeing normal Ubuntu behavior—not a failed install. Ubuntu pins a default python3 for each release so system tools stay stable. This guide shows how to install the latest upstream Python or upgrade your own projects to a newer line side-by-side with that default, create a working virtual environment, and avoid replacing /usr/bin/python3.
Tested on: Python 3.14.6; system
python33.13.3; kernel 6.14.0-37-generic; Ubuntu 25.04.
The source-build (make altinstall) and virtual-environment steps were run on this host. Deadsnakes PPA commands and package names match the packages published for Ubuntu 22.04 (jammy) and 24.04 (noble) on the Deadsnakes PPA. On an LTS machine, run the PPA block there; expect python3.14 --version to report the PPA patch level (for example 3.14.6) while python3 --version stays on the release default.
Why Ubuntu does not always provide the latest Python
Ubuntu chooses one primary python3 per release and updates it on a stability schedule. That version powers apt hooks, system scripts, and many .deb packages. Upstream Python on python.org moves faster—Python 3.14.6 is the current stable download at the time of writing—so the default python3 on an LTS system is often several minor releases behind.
| Ubuntu version | Default python3 (typical) |
Notes |
|---|---|---|
| Ubuntu 22.04 LTS (jammy) | Python 3.10 | Deadsnakes ships newer versions such as 3.13 and 3.14; it does not repackage 3.10 because Ubuntu already provides it. |
| Ubuntu 24.04 LTS (noble) | Python 3.12 | Deadsnakes ships 3.13, 3.14, and others; it does not repackage 3.12 because Ubuntu already provides it. |
| Ubuntu 26.04 (resolute) | Python 3.14 | Check python3 --version for the exact patch level; Deadsnakes generally does not repackage the same version Ubuntu ships. |
The safe rule for this article: install the latest Python next to the system Python. Do not remove python3, do not overwrite /usr/bin/python3, and do not point pip at the system interpreter with sudo.
Check your current Python version
Run these checks before you install anything. They explain the “already newest” message and show whether a versioned binary is already present.
Check your Ubuntu release:
lsb_release -dsExample on Ubuntu 24.04:
Ubuntu 24.04.2 LTSCheck the default interpreter Ubuntu wired to python3:
python3 --version
which python3Example on Ubuntu 24.04 before adding a newer Python:
Python 3.12.3
/usr/bin/python3See whether a newer versioned binary is already installed (adjust the minor version if you target 3.13 instead of 3.14):
python3.14 --version
command -v python3.14If the command is missing, the shell reports command not found—that is expected until you install from Deadsnakes or build from source.
See what apt considers the newest default Python package:
apt-cache policy python3
apt-cache policy python3.14On Ubuntu 24.04, python3 may show a candidate with no python3.14 package until you add the Deadsnakes PPA:
python3:
Installed: 3.12.3-0ubuntu2
Candidate: 3.12.3-0ubuntu2
python3.14:
Installed: (none)
Candidate: (none)After enabling Deadsnakes on jammy or noble, apt-cache policy python3.14 should list a candidate such as 3.14.6-1+noble1.
Two Python versions on one system is normal
A clean Ubuntu LTS install usually has one system Python: python3 points at the release default (3.10 or 3.12). After you follow this guide, having two interpreters is expected—not a misconfiguration:
| Command | Typical role |
|---|---|
python3 |
Ubuntu system default; leave it for apt and OS tools |
python3.14 (or python3.15) |
Newer interpreter you installed for your projects |
List versioned binaries Ubuntu and Deadsnakes provide:
ls /usr/bin/python3* 2>/dev/null
command -v python3.14 python3.15 2>/dev/nullUse the versioned binary (python3.14, python3.15) or a virtual environment for application work. Do not symlink or update-alternatives over /usr/bin/python3 unless you accept breaking system packages.
Choose the right installation method
Pick one primary path. You can keep a source-built python3.14 under /usr/local/bin while the system python3 stays under /usr/bin—they coexist by design.
| Method | Best for | Notes |
|---|---|---|
| Ubuntu apt repo | Default supported Python for your release | Safest for system tools; may not match the latest python.org release. |
| Deadsnakes PPA | Stable 3.14 or pre-release 3.15 on Ubuntu LTS | Convenient on 22.04/24.04; third-party PPA—review trust and update policy for production servers. |
Source build with make altinstall |
Exact upstream tarball from python.org | You manage rebuilds; altinstall avoids clobbering python3. See source install below. |
| pyenv | Many versions per user or project | Use when you switch often between three or more lines; see the short note near the end. |
Deadsnakes describes itself as providing “new and old Python versions for Ubuntu.” pyenv focuses on installing and switching multiple interpreters per user or directory—useful when you juggle more than one newer version, not only when you need a single latest build.
Install latest Python from source
Use this when you want the exact tarball from python.org or when no Deadsnakes package exists for your Ubuntu series.
Run make altinstall, not make install. A normal install can create or overwrite /usr/local/bin/python3 and confuse tools that expect Ubuntu’s pinned interpreter. altinstall installs only versioned binaries such as python3.14 or python3.15 under /usr/local and leaves system python3 alone.
Install build dependencies once (shared by both versions below):
sudo apt update
sudo apt install -y build-essential zlib1g-dev libncurses5-dev libgdbm-dev \
libnss3-dev libssl-dev libreadline-dev libffi-dev libsqlite3-dev libbz2-devPick one subsection—3.14 stable or 3.15 pre-release. Each block is a full source install for that version.
Python 3.14 (stable) from source
Download and extract the current stable release (adjust the patch version if a newer one is on python.org):
cd /tmp
curl -fsSLO https://www.python.org/ftp/python/3.14.6/Python-3.14.6.tgz
tar -xf Python-3.14.6.tgz
cd Python-3.14.6Configure and build. A plain ./configure is enough; add --enable-optimizations only if you accept a much longer PGO build:
./configure
make -j"$(nproc)"
sudo make altinstallVerify:
python3.14 --version
which python3.14
python3 --versionExample from a successful altinstall test:
$ python3.14 --version
Python 3.14.6
$ which python3.14
/usr/local/bin/python3.14
$ python3 --version
Python 3.13.3System python3 stays on the Ubuntu package; python3.14 lives under /usr/local/bin. To upgrade later, download a newer 3.14 tarball, rebuild, and run sudo make altinstall again.
Python 3.15 (pre-release) from source
Python 3.15 is still in beta at the time of writing—use it for testing, not production servers. Download the current pre-release from the Python 3.15.0 release folder (adjust the beta tag if a newer one is published):
cd /tmp
curl -fsSLO https://www.python.org/ftp/python/3.15.0/Python-3.15.0b2.tgz
tar -xf Python-3.15.0b2.tgz
cd Python-3.15.0b2Configure, build, and install:
./configure
make -j"$(nproc)"
sudo make altinstall
python3.15 --version
which python3.15Expected output shape:
Python 3.15.0b2
/usr/local/bin/python3.15When 3.15 reaches a final stable release, rebuild from the stable tarball the same way.
Install latest Python using the Deadsnakes PPA
This is the main practical path on Ubuntu 22.04 and 24.04 when you want a packaged interpreter without compiling. The Deadsnakes PPA publishes versioned packages for jammy and noble.
Add the PPA once before either version subsection below:
sudo apt update
sudo apt install -y software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt updatePick one subsection—3.14 stable or 3.15 pre-release. Third-party .deb Python modules from Ubuntu’s main archive target the default python3, not Deadsnakes builds—use pip inside a virtual environment for project packages.
Python 3.14 (stable) from Deadsnakes
Install the stable interpreter and packages for venvs and C extensions:
sudo apt install -y python3.14 python3.14-venv python3.14-devVerify with the versioned command—not python3:
python3.14 --version
which python3.14
python3 --versionExpected shape on noble or jammy:
Python 3.14.6
/usr/bin/python3.14On Ubuntu 24.04, python3 --version should still show 3.12.x; on 22.04, 3.10.x. Do not repoint /usr/bin/python3 to 3.14.
Optional companion packages:
python3.14-distutils— only on older lines wheredistutilsis split out
Python 3.15 (pre-release) from Deadsnakes
Python 3.15 is still in beta—for experiments, not production. If you skipped the PPA steps above, run them first, then install:
sudo apt install -y python3.15 python3.15-venv python3.15-dev
python3.15 --version
which python3.15
python3 --versionExpected output shape:
Python 3.15.0b2
/usr/bin/python3.15System python3 must remain unchanged. Refresh the package when Deadsnakes publishes a newer beta or the final 3.15 release.
Create a virtual environment after installing a new Python
Installing python3.14 or python3.15 gives you a new interpreter binary—it does not automatically isolate project packages (requests, django, and so on). A virtual environment (venv) is a small directory that:
- pins one Python version for a project or experiment
- keeps
pipinstalls out of the system interpreter and away from PEP 668 restrictions on/usr/bin/python3 - lets you delete the project environment later without touching Ubuntu’s
python3
Run these steps after you install a versioned Python from Deadsnakes or source. Replace 3.14 with 3.15 (or another line) everywhere in the commands if that is what you installed.
Step 1: Install the matching venv package (Deadsnakes only)
If you used the Deadsnakes PPA, install the -venv package for your version (often bundled with the main package, but install it explicitly if venv fails):
sudo apt install -y python3.14-venv
# pre-release example:
# sudo apt install -y python3.15-venvSource installs from make altinstall usually include ensurepip; you can skip this apt step unless python3.14 -m venv errors.
Step 2: Create and activate the venv
Use the same versioned binary you installed—not bare python3:
python3.14 -m venv ~/venvs/myproject
source ~/venvs/myproject/bin/activate
python --version
python -m pip install --upgrade pipPre-release example:
python3.15 -m venv ~/venvs/py315-beta
source ~/venvs/py315-beta/bin/activate
python --versionAfter source .../activate, the shell command python points at the venv’s interpreter (3.14 or 3.15), not system python3.
Step 3: Install packages inside the venv
python -m pip install requestsExample after activating a 3.14 venv:
$ python --version
Python 3.14.6
$ python -m pip --version
pip 26.1.2 from /home/you/venvs/myproject/lib/python3.14/site-packages/pip (python 3.14)Leave the venv with deactivate. Prefer python -m pip over bare pip whenever multiple Python versions exist on the host.
If global python3 -m pip install fails on the system interpreter, that is expected on Ubuntu 23.04+:
error: externally-managed-environmentCreate a venv with your new versioned Python instead—do not use sudo pip on /usr/bin/python3.
For packaging workflows after your venv is ready, see create a Python package and pip requirements.txt.
How to install or upgrade Python on Ubuntu safely
On Ubuntu, “upgrade Python” almost never means “replace the system python3 package in place.” It means add a newer interpreter beside the system default, then move your project to it. The install steps above (3.14 stable or 3.15 pre-release) are the upgrade path for your code—you do not uninstall the old system python3.
Follow this pattern:
- Install the newer version (
python3.14,python3.15, or a sourcealtinstall) without removing the defaultpython3. - Do not delete
/usr/bin/python3or repoint it with alternatives for system-wide use. - Create a new virtual environment with the newer interpreter.
- Reinstall dependencies (
python -m pip install -r requirements.txtor your lockfile workflow). For Git-based deps, see install a Python package from GitHub. - Update project-specific paths only: shebangs (
#!/usr/bin/env python3.14or venv python), systemdExecStart=, cron entries, CI images, and your IDE interpreter setting. - Run your test suite before decommissioning the old venv.
Upgrading Ubuntu itself (for example 22.04 → 24.04) may bump the default python3 as part of the release. That is separate from installing python.org’s latest minor release on a single LTS install.
Troubleshooting
python3 still shows the old version after installing a new Python
Expected. Installing python3.14 does not change python3. Use python3.14 explicitly or activate a venv created with that interpreter.
python3.14 or python3.15: command not found
The versioned package is not installed, or /usr/local/bin is not on your PATH for source builds. Install from Deadsnakes or finish make altinstall, then run command -v python3.14 or command -v python3.15.
Unable to locate package python3.14 or python3.15
Common causes:
- Deadsnakes PPA not added, or
sudo apt updatenot run afterward. - Wrong Ubuntu series—the PPA publishes builds for jammy, noble, and resolute; very old or non-LTS versions may lack packages.
- Typo in the package name (use
python3.14orpython3.15, notpython3.14.6).
ensurepip is disabled / python3.14 -m venv or python3.15 -m venv fails
Install the matching venv package:
sudo apt install -y python3.14-venv
# or for pre-release:
sudo apt install -y python3.15-venvFor source installs, ensurepip runs during altinstall; if venv still fails, confirm the build finished without import errors (python3.14 -m venv /tmp/testvenv).
externally-managed-environment
You tried to pip install into the OS-managed python3. Create a venv with your target interpreter instead:
python3.14 -m venv ~/venvs/myproject
source ~/venvs/myproject/bin/activate
python -m pip install <package>pip installs into the wrong Python version
Always use python -m pip from the interpreter you intend—especially inside a venv after source .../bin/activate. Avoid bare pip or pip3 when multiple Python versions coexist; they may map to the system default.
sudo apt install python3 says python3 is already the newest
That refers only to the default Ubuntu package. Install python3.14 or python3.15 from Deadsnakes, or build from source, for a newer line.
When to use pyenv instead
Use pyenv when you routinely switch between three or more versions (3.10 for legacy, 3.12 for one service, 3.14 for another) on the same user account. pyenv installs interpreters under ~/.pyenv and can set a per-directory version with .python-version.
For installing or upgrading to one newer Python on Ubuntu 22.04 or 24.04, Deadsnakes or a single source altinstall is usually simpler than pyenv.
Summary
Ubuntu pins python3 per release for stability, so apt install python3 can be “newest” while still older than python.org. On 22.04 and 24.04, add the Deadsnakes PPA and install stable python3.14 with matching -venv and -dev packages, or optional pre-release python3.15 for testing—or build from the official tarball with make altinstall. Never use make install and never replace /usr/bin/python3. Having python3 and python3.14 side-by-side is normal. Create a virtual environment, use python -m pip inside it, and point your project at the venv or versioned binary when you upgrade application code. Use pyenv only when you juggle many versions on one workstation.
References
- Python downloads
- Python 3.15.0 pre-release source files
- Deadsnakes PPA
- PEP 668 — Marking Python base environments as externally managed
- Python Packaging User Guide — Installing packages
- pyenv
- Remove Python on Ubuntu without breaking system python3

