| Tested on | Ubuntu 26.04 LTS (Resolute Raccoon) |
|---|---|
| Package | python3.11 3.11.17-1+resolute1 (Deadsnakes on 26.04) |
| Applies to | Ubuntu 22.04 LTS, 24.04 LTS, and 26.04 LTS |
| Privilege | sudo for apt and PPA; normal user for uv, pyenv, and venv |
| Scope | Install Python 3.11 when a project, wheel, or CI image pins 3.11—not when you want the newest CPython. Covers Deadsnakes, uv, and pyenv beside system python3 on jammy, noble, and resolute. For upstream 3.15, use the latest-Python install guide in Related guides. |
| Related guides | Install Python 3.12 on Ubuntu Install Python 3.15 on Ubuntu |
Install Python 3.11 when compatibility requires that minor—not because you want the latest upstream release.
Python 3.11 lifecycle (October 2026):
- 3.11.17 is a security release—the series is security-fixes-only
- Regular bugfix releases have ended; security support continues until October 2027
- Prefer a newer supported feature release for new projects unless an app or dependency pins 3.11
Pick an install path:
┌─────────────────────────────────┐
│ Need Python 3.11 on Ubuntu? │
└────────────────┬────────────────┘
│
┌──────────────────┴──────────────────┐
▼ ▼
┌─────────────────────────┐ ┌─────────────────────────────┐
│ APT-managed side-by-side│ │ User-level / many versions │
└────────────┬────────────┘ └──────────────┬──────────────┘
▼ ┌────────┴──────────┐
┌─────────────────────────┐ ▼ ▼
│ Deadsnakes PPA │ ┌────┐ ┌───────┐
│ (3.11.x on LTS) │ │ uv │ │ pyenv │
└─────────────────────────┘ └────┘ └───────┘Quick answer: Python 3.11 on Ubuntu by release
Pick a path by release:
- 26.04 / 24.04 — Deadsnakes, uv, or pyenv (no current 3.11 in the standard archive for side-by-side use)
- 22.04 — older
python3.11from jammy-updates whilepython3stays 3.10; use Deadsnakes, uv, or pyenv for a newer 3.11.x release (for example 3.11.17)
Deadsnakes quick path (after add-apt-repository works on your host):
sudo apt update
sudo apt install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
apt-cache policy python3.11
sudo apt install python3.11 python3.11-venv
python3.11 --version
python3 --versionExample on Ubuntu 26.04 after Deadsnakes install:
Python 3.11.17
Python 3.14.4python3 stayed on the 3.14 series; only python3.11 picked up 3.11.17.
Create a venv next:
- Do not use
sudo pipon systempython3(PEP 668 applies on current Ubuntu) - Use
python3.11 -m venv, activate, thenpython -m pip
python3.11 -m venv ~/venvs/py311
source ~/venvs/py311/bin/activate
python --version
python -m pip install --upgrade pip
python -m pip --versionPython 3.11 availability on Ubuntu 26.04, 24.04, and 22.04
| Ubuntu | Default python3 |
3.11 in Ubuntu archive? | When you need newer 3.11 patch releases |
|---|---|---|---|
| 26.04 LTS | 3.14 series | No current python3.11 in the standard 26.04 archive |
Deadsnakes, uv, or pyenv |
| 24.04 LTS | 3.12 | No | Deadsnakes, uv, or pyenv |
| 22.04 LTS | 3.10 | Yes—older python3.11 in jammy-updates |
Deadsnakes/uv/pyenv for a newer 3.11.x release |
Why install 3.11 at all:
- 24.04 — default is 3.12; wheels or CI still target 3.11
- 26.04 — default is 3.14; applications that still require 3.11
- 22.04 — default is 3.10; install 3.11 when the app requires that specific minor
Confirm your row with check Ubuntu version before changing repositories.
Before you install: keep Ubuntu's system Python unchanged
python3. apt, cloud-init, and many packages expect the release-managed interpreter at /usr/bin/python3.
Do not:
- Run
sudo update-alternatives --config python3to point system tools at 3.11 - Replace or symlink over
/usr/bin/python3manually - Copy a custom
python3.11binary onto/usr/bin/python3
Do instead:
- Call
python3.11explicitly, or activate a project venv - Leave
python3for Ubuntu-owned packages
Verify system ownership after any install:
readlink -f /usr/bin/python3
python3 --version
python3.11 --versionExpected series (patch numbers vary with updates):
- 22.04 —
python3→ 3.10 - 24.04 —
python3→ 3.12 - 26.04 —
python3→ 3.14
If readlink or dpkg -S shows a custom 3.11 binary owning system python3:
- Restore Ubuntu's
python3packages—do not keep retargeting alternatives - Use the dpkg command to see which package owns the path
dpkg -S "$(readlink -f /usr/bin/python3)"Install Python 3.11 with Deadsnakes on Ubuntu
Deadsnakes notes:
- Community-maintained third-party PPA—not Canonical's default archive
- Convenient for alternate Python versions on jammy, noble, and resolute
- Installs
python3.11beside systempython3, not instead of it - Deadsnakes maintainers do not guarantee the same security-update cadence as Ubuntu's official archive—weigh that for production or security-sensitive workloads (PPA overview)
Add the Deadsnakes PPA for Python 3.11 on Ubuntu
Install the helper that provides add-apt-repository, then enable the PPA:
sudo apt install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt updateVerify the Python 3.11 package source on Ubuntu
Before apt install, confirm which build apt will use—especially on 22.04, where jammy archive and the PPA can both offer python3.11:
apt-cache policy python3.11When you intend Deadsnakes, confirm:
- Candidate comes from
ppa.launchpadcontent.net/deadsnakes/ppa - Suite matches your release (jammy / noble / resolute)
- On 22.04, archive and PPA can both list
python3.11—read the policy output before installing
Example apt-cache policy on Ubuntu 26.04:
python3.11:
Installed: (none)
Candidate: 3.11.17-1+resolute1
Version table:
3.11.17-1+resolute1 500
500 https://ppa.launchpadcontent.net/deadsnakes/ppa/ubuntu resolute/main amd64 PackagesYour Candidate line should name the Deadsnakes PPA; patch numbers update when the PPA ships new builds.
Install Python 3.11 and venv
Minimal install for most projects (apt packages):
sudo apt install python3.11 python3.11-venvConfirm system python3 did not change:
python3.11 --version
command -v python3.11
python3 --version
command -v python3Optional development headers
Install headers only when you need them:
- Install
python3.11-devwhen compiling C extensions or building against Python headers - Skip
-devwhen you only run apps and install wheels withpipinside a venv
sudo apt install python3.11-devCreate a Python 3.11 virtual environment
A venv does not install Python 3.11—it isolates packages after python3.11 exists.
python3.11 -m venv ~/venvs/py311-app
source ~/venvs/py311-app/bin/activateVerify Python and pip inside the venv
Confirm the activated shell uses the venv interpreter—not system python3:
python --version
python -m pip --versionExpected shape:
Python 3.11.17
pip ... from .../venvs/py311-app/lib/python3.11/site-packages/pip (python 3.11)Upgrade pip inside the venv:
python -m pip install --upgrade pipPackage installs on Ubuntu:
- Do not use
sudo piporpip install --break-system-packageson systempython3 - Install project dependencies only inside the activated venv
- If bare
pipis missing before Python is set up, see pip command not found
Sanity-check common modules (especially after pyenv builds):
python -c "import ssl, sqlite3, bz2, lzma; print('Python 3.11 OK')"Deactivate with deactivate.
Alternative: Install Python 3.11 with uv
uv fits when you want user-level Python without a PPA:
- Managed CPython under your account—not
/usr/bin/python3 - Does not replace system
python3 uv python install 3.11tracks the latest 3.11 patch uv publishes
| Method | Best for |
|---|---|
| Deadsnakes | APT-managed, system-wide python3.11 beside Ubuntu's default |
| uv | Fast user-level Python + venvs without a PPA |
| pyenv | Many CPython versions and per-directory switching |
Install uv:
curl -LsSf https://astral.sh/uv/install.sh | shInstall the latest 3.11 patch uv knows about and create a venv:
uv python install 3.11
uv venv --python 3.11 .venv
source .venv/bin/activate
python --versionuv notes:
- Uses Astral managed builds—not python.org Linux installer tarballs
- A developer-managed Python installation under your account—not an Ubuntu
python3package
Alternative: Use pyenv for multiple Python versions
pyenv when you juggle many versions:
- Compiles CPython under
~/.pyenv/versions/(requires build deps and a compiler) - Full install steps: install latest Python on Ubuntu
pyenv install 3.11usually resolves the latest 3.11 patch yourpython-buildplugin knows
After pyenv is installed:
pyenv install 3.11
pyenv local 3.11
python --version/usr/bin/python3stays on the Ubuntu default;pythonfollows pyenv in that directory- Custom tarball builds belong on the latest-Python page—this article focuses on Deadsnakes, uv, and pyenv
Update Python 3.11
Deadsnakes — refresh indexes and upgrade packages when the PPA publishes newer 3.11.x builds:
sudo apt update
sudo apt install python3.11 python3.11-venvRe-running apt install pulls newer 3.11.x builds when the PPA (or archive) publishes them.
uv — upgrade the managed 3.11 line:
uv python upgrade 3.11pyenv — install a newer patch (pyenv install 3.11.x) and update .python-version or pyenv local.
Uninstall Python 3.11
Ubuntu 22.04, 24.04, and 26.04
See what is installed and where it came from:
apt-cache policy python3.11
dpkg -l | grep '^ii python3.11'On 22.04, read apt-cache policy python3.11 before you remove anything—Ubuntu's jammy-updates build and a Deadsnakes build are different sources. Uninstall only the packages you added, and drop the PPA only if no other Deadsnakes Python versions still need it.
Remove only packages you added (omit python3.11-dev if you never installed it):
sudo apt remove python3.11 python3.11-venvAfter apt remove:
- venv directories (
~/venvs/,./.venv) are not deleted—remove them yourself - PPA removal—only when no other Deadsnakes Python packages are still needed (3.12, 3.13, etc.)
To drop the PPA when it is safe:
sudo add-apt-repository --remove ppa:deadsnakes/ppa
sudo apt updateFull removal patterns (pyenv, source, mixed installs): Uninstall Python on Ubuntu.
Troubleshooting Python 3.11 on Ubuntu
| Symptom | Likely cause | Fix |
|---|---|---|
Unable to locate package python3.11 |
PPA missing, stale indexes, or wrong suite | sudo apt update; check apt-cache policy python3.11 |
| Wrong/old 3.11 on 22.04 | Ubuntu archive candidate wins over PPA | Re-check apt-cache policy; install explicit Deadsnakes version or pin PPA priority |
python3.11 -m venv fails |
python3.11-venv not installed |
sudo apt install python3.11-venv |
pip: command not found |
No venv active, or pip not on PATH | Activate venv; use python -m pip |
externally-managed-environment |
pip install against system python3 |
Create a 3.11 venv; install packages inside it |
python3 still shows 3.12 / 3.14 |
Expected | Use python3.11 or an activated venv |
apt errors after “switching” Python |
System python3 was retargeted |
Restore Ubuntu python3 packages; do not use update-alternatives on python3 |
pyenv build missing _ssl / sqlite3 |
Build dependencies missing | Install build deps from latest-Python pyenv section, or use Deadsnakes/uv |
Summary: install Python 3.11 on Ubuntu
Install Python 3.11 when an application, wheel, or CI image requires that minor—not for the newest CPython.
- Lifecycle — security-fixes-only through October 2027
- 26.04 / 24.04 — Deadsnakes, uv, or pyenv beside the distro default
- 22.04 — archive
python3.11exists but is old; use Deadsnakes/uv/pyenv for newer 3.11 patch releases on supported LTS versions - Safety — never repoint
/usr/bin/python3; usepython3.11and venvs withpython -m pip - Upstream 3.15 — use the latest-Python hub in the intro Related guides
References
- Deadsnakes PPA
- Python 3.11.17 release notes
- Python 3.11 documentation
- PEP 668 — externally managed environments
- uv — Python versions
Frequently Asked Questions
Why install 3.11 on Ubuntu 24.04 when 3.12 is default?
- Some apps and wheels target 3.11 only
- Install
python3.11besidepython3—do not downgrade system Python
Does Ubuntu 22.04 ship Python 3.11?
- 22.04 defaults to Python 3.10 for
python3 - Ubuntu also ships python3.11 in jammy-updates (older than current upstream)
- For a newer 3.11.x release (for example 3.11.17), use Deadsnakes, uv, or pyenv—and compare each method's update trust model
Should I use Deadsnakes or uv for Python 3.11?
- Deadsnakes — APT-managed
python3.11system-wide beside Ubuntu's default - uv — fast user-level Python and venvs without a PPA
- pyenv — many versions and per-project switching
Should I make Python 3.11 the default python3 on Ubuntu?
No. Leave Ubuntu's python3 untouched for apt and system tools. Use python3.11 explicitly or a virtual environment for your project.

