Python 3.13 has been finally officially released as stable on October 2024, while Python 3.12 is already out and widely used, but Python 3.13 appears to offer some new features.
The main highlights are a new interactive interpreter based on PyPy, free-threaded mode to run more processes concurrently by disabling the Global Interpreter Lock, an experimental JIT compiler for performance enhancement, an incremental (cyclic) garbage collector, new typing features, and other significant changes.
If you are currently maintaining a Python-related project, you should definitely start the process of transitioning to Python 3.13, and if you find any bugs or issues, make sure to create new issues on the Python Github page.
In this quick guide, I'll show you how to install Python 3.13 on Ubuntu and other Linux distributions such as Debian, Red Hat, Fedora, Rocky Linux, Arch, or Manjaro.
Install Python 3.13 on Ubuntu and Other Linux Distros
There are two ways to install Python 3.13 on Ubuntu: using the Ubuntu PPA or manually compiling and installing from the source code. While the PPA method is only available for Ubuntu users, those using other Linux distros should consider using the source code method.
Method 1: Install Python 3.13 Using Ubuntu PPA
A user named Deadsnakes maintains an Ubuntu PPA to make it easier for Ubuntu users to install the latest or beta version of Python. Since it's an individual effort, there might be some delay in updates, so you can use it for testing but avoid using it in production.
To start the Python 3.13 installation, open your terminal, add the Deadsnakes PPA to your system, and install the Python 3.13 version by running these commands.
# Adding the Deadsnakes PPA
$ sudo add-apt-repository ppa:deadsnakes/ppa
# Updating the package database
$ sudo apt update
# Installing the Python 3.13
$ sudo apt install python3.13
Once done, run the following command to verify the Python version:
$ python3.13 --version
Now that you have installed Python 3.13 on your Ubuntu system, you can start exploring its various features and functionalities.
Method 2: Install Python 3.13 With Source Code
Many Linux distributions, especially Debian, Fedora, or Arch Linux, often add the latest stable version of Python to their repositories. However, the official release of Python 3.13 is still miles ahead, so you'll have to either wait or follow the instructions below to install it from the source code.
To start, open your terminal, run one of the suitable commands to download and install the necessary dependencies for compiling and installing Python 3.13.
# On Debian, Ubuntu, Kali Linux, Linux Mint, Zorin OS, Pop!_OS, etc.
$ sudo apt install build-essential pkg-config
# On Red Hat, Fedora, CentOS, Rocky Linux, AlmaLinux, etc.
$ sudo dnf install groupinstall "Development Tools" pkgconfig
# On Arch Linux, Manjaro, BlackArch, Garuda, etc.
$ sudo pacman -S base-devel pkgconf
Afterward, go to the Python 3.13 release page, simply scroll down to the bottom, and choose the Linux tarball file.
Once the download completes, head to your terminal, navigate to the downloads directory, and run the following commands to build, compile, and install Python 3.13 on Linux.
# Decompressing the tarball file and entering the extracted directory
$ tar -xf Python-*.tgz && cd Python-*/
# Configuring the package with the required dependencies
$ ./configure --enable-optimizations
# Compiling and installing Python 3.13
$ make & sudo make install
Once the installation is complete, you can verify it by checking the Python version.
$ python3.13 --version
Tada! You have successfully installed Python 3.13 on your Linux system.
Uninstall Python 3.13 from Ubuntu and Other Linux Distros
To remove Python installed using the Deadsnakes PPA on Ubuntu, run:
$ sudo add-apt-repository --remove ppa:deadsnakes/ppa
$ sudo apt remove python3.13
$ sudo apt autoremove
To uninstall Python built from source, run this command.
$ sudo find /usr/local/ -name "*python*3.13*" | sudo xargs -n 1 -tp rm -rf
The above command will prompt for confirmation prior to deleting the files and directories associated with Python 3.13. Type "y" to approve.
That's all for now. I hope you are able to install Python 3.13 on Ubuntu and other Linux distros, and if you encounter any difficulties during installation or uninstallation (especially from source code), feel free to ask for help in the comment section.