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.
  • 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.

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

Managing Ubuntu on bare metal at scale

Modern infrastructure teams are expected to deliver cloud-like speed, consistency, and reliability, even when their…

1 day ago

Ubuntu Server: a platform made for enterprise scale

A platform is an environment that allows software to run smoothly across the infrastructure, runtime,…

2 days ago

Building an open source chain of trust: new research uncovers key blockers and ways forward

Canonical is pleased to share its latest research report, “The open source chain of trust.”…

3 days ago

Beyond safety and security: Why automotive open source demands dependability

In the traditional automotive world, teams often work in silos: the cybersecurity experts lock down…

3 days ago

Ubuntu 26.10 Snapshot 2 Arrives with Updated Image Structure and Testing Improvements

The second development snapshot of Ubuntu 26.10, also known as “Stonking Stingray”, is now available…

5 days ago

Ubuntu Expands Livepatch Support to Arm64 Systems for Zero-Downtime Kernel Updates

Canonical has extended Ubuntu Livepatch support to Arm64 platforms, allowing compatible Ubuntu systems running on…

5 days ago