Categories: Ubuntu

How to Install Python 3.13 (Dev) in Ubuntu 22.04 / 20.04

This simple tutorial shows how to install Python 3.13, which is still in development stage, in Ubuntu 22.04, or Ubuntu 20.04 LTS.

Python 3.13 so far is in alpha development stage. For testing or software developing purpose, you can install it in Ubuntu either from PPA or by building from source tarball.

Features in Python 3.13 so far, compare to the last 3.12:

  • exception tracebacks now colorized by default in the interactive interpreter.
  • Docstrings now have their leading indentation stripped , reducing memory use and the size of .pyc files.
  • Removals of many deprecated modules: aifc, audioop, chunk, cgi, cgitb, crypt, imghdr, mailcap, msilib, nis, nntplib, ossaudiodev, pipes, sndhdr, spwd, sunau, telnetlib, uu, xdrlib, lib2to3.
  • Sponsored
  • Many other removals of deprecated classes, functions and methods in various standard library modules.
  • New deprecations, most of which are scheduled for removal from Python 3.15 or 3.16.
  • C API removals and deprecations.

Python 3.13 IDE

Option 1: Install Python 3.13 from Ubuntu PPA

The popular deadsnakes PPA has built the latest Python 3.13 alpha for current 2 Ubuntu LTS releases.

1. First, press Ctrl+Alt+T on keyboard to open terminal. When it opens, run command to add the PPA:

sudo add-apt-repository ppa:deadsnakes/ppa

Type user password when it asks (no visual feedback) for sudo authentication and hit Enter to continue.

2. Then, install Python 3.13 by running command (Linux Mint needs to run sudo apt update first to refresh package cache):

sudo apt install python3.13

For choice, replace python3.13 in command with python3.13-full to also install GNU dbm database support, tkinter, as well as the IDE.

3. After installation, verify its version by running command:

python3.13 --version

4. To get pip package installer for Python3.13, just run the ensurepip module which provides support for bootstrapping the pip installer into an existing Python installation.

python3.13 -m ensurepip --upgrade

Then verify via: python3.13 -m pip --version, and upgrade it via python3.13 -m pip install --upgrade pip.

Option 2: Compile Python 3.13 from source tarball

1. First, press Ctrl+Alt+T on keyboard to open terminal. When it opens, run command to install the required libraries for building Python:

sudo apt install wget build-essential libreadline-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev libffi-dev zlib1g-dev

2. Then, select download the most recent dev version of Python 3.13 (so far Python-3.13.0a3.tar.xz) from the link page below:

3. Next, extract the source tarball in file manager. Then, right-click on extracted folder and select “Open in terminal” to open that folder as working directory in terminal.

Sponsored

4. In the pop-up terminal, configure the source via command:

./configure --enable-optimizations

For choice, you can run ./configure --help to print more configure options.

Then, compile by starting 4 threads in parallel:

make -j4

And finally install Python 3.13:

sudo make install

Finally, verify via command: python3.13 --version and pip3.13 --version.

Uninstall:

For Python 3.13 installed from PPA, open terminal and run command to remove it:

sudo apt remove --autoremove python3.13

Also remove the PPA by running command:

sudo add-apt-repository --remove ppa:deadsnakes/ppa

If you compiled it from source, then try running the command below from source folder until you removed it:

sudo make uninstall

Or, manually delete all the corresponding files and folders (run whereis python3.13 to tell).

The post How to Install Python 3.13 (Dev) in Ubuntu 22.04 / 20.04 appeared first on Osgrove.

Ubuntu Server Admin

Recent Posts

Canonical Releases Ubuntu 25.04 Plucky Puffin

The latest interim release of Ubuntu introduces “devpacks” for popular frameworks like Spring, along with…

22 hours ago

Ubuntu 25.04 (Plucky Puffin) Released

Ubuntu 25.04, codenamed “Plucky Puffin”, is here. This release continues Ubuntu’s proud tradition of integrating…

2 days ago

Extended Security Maintenance for Ubuntu 20.04 (Focal Fossa) begins May 29, 2025

Ubuntu released its 20.04 (Focal Fossa) release 5 years ago, on March 23, 2020. As…

2 days ago

Ubuntu 20.04 LTS End Of Life – activate ESM to keep your fleet of devices secure and operational

Focal Fossa will reach the End of Standard Support in May 2025, also known as…

3 days ago

Ubuntu MATE 25.04 Release Notes

Ubuntu MATE 25.04 is ready to soar! 🪽 Celebrating our 10th anniversary as an official…

3 days ago

Ubuntu Weekly Newsletter Issue 887

Welcome to the Ubuntu Weekly Newsletter, Issue 887 for the week of April 6 –…

4 days ago