Install Python 3.13 on AlmaLinux and Rocky Linux: Easy Setup
This guide provides a comprehensive walkthrough on How To Install Python 3.13 on AlmaLinux and Rocky Linux. Python’s versatility makes it indispensable for system automation, scripting, software development, and server management on these distributions. It underpins numerous Linux tools, playing a critical role in administration, security protocols, and package management.
The current stable iteration, Python 3.13, offers enhanced features and performance improvements. The following steps, originally featured on the Orcacore website, will guide you through the process of installing Python 3.13 on AlmaLinux 8/9 and Rocky Linux 8/9.
Before we begin, ensure you’re logged into your server as a non-root user with sudo
privileges. This guide utilizes AlmaLinux 9 for demonstration purposes, but the process is nearly identical for Rocky Linux. Let’s get started to Install Python 3.13 on AlmaLinux and Rocky Linux.
1. Install Dependencies For Python 3.13 Setup
First, it’s essential to update your system’s package lists to ensure you have the latest versions of available software. Use the following command:
sudo dnf update -y
Next, install the necessary packages and dependencies required for compiling and installing Python 3.13. Execute the following commands:
sudo dnf install gcc openssl-devel bzip2-devel libffi-devel zlib-devel wget make tar -y
sudo dnf groupinstall "Development Tools" -y
These commands install the GNU Compiler Collection (GCC), OpenSSL development libraries, bzip2 libraries, Foreign Function Interface library, zlib compression library, wget
(for downloading the source package), make
(for building the software), and tar
(for extracting the source archive). The Development Tools
group install provides a comprehensive suite of development utilities.
With the dependencies in place, you’re ready to download the Python 3.13 source package.
2. Download Python 3.13 Source Package
Navigate to the Python Source Releases page to find the latest stable version of Python 3.13. Then, utilize the wget
command to download the source package:
sudo wget https://www.python.org/ftp/python/3.13.2/Python-3.13.2.tgz

After the download completes, extract the downloaded archive using the tar
command:
sudo tar -xf Python-3.13.2.tgz
Finally, change your directory to the extracted Python 3.13 source directory:
cd Python-3.13.2
3. Build and Install Python 3.13
Now, you’re ready to build and install Python 3.13 on your AlmaLinux or Rocky Linux system. First, configure the build process with the following command, enabling optimizations for performance:
sudo ./configure --enable-optimizations
This command checks your system for the required dependencies and configures the build process. The --enable-optimizations
flag enables Profile Guided Optimization (PGO), which can improve the performance of the resulting Python interpreter.
When configuration is finished, you will see an output similar to this:
Determine the number of CPU cores available on your system using the nproc
command:
sudo nproc
**Example Output**
4
Use this number to specify the number of parallel build jobs to speed up the compilation process. For instance, if your system has 4 cores, use the following command:
sudo make -j 4
This process will take some time, depending on your system’s resources. After the build process is complete, install Python 3.13 using the altinstall
target:
sudo make altinstall
The altinstall
target prevents the installation from overwriting the system’s default Python interpreter. It installs Python 3.13 as python3.13
.
Verify the installation by checking the Python version:
python3.13 --version
**Output**
Python 3.13.2
4. Create a Test Project with Python 3.13
To confirm that Python 3.13 is functioning correctly, create a simple test project. First, create a project directory and navigate into it:
mkdir ~/test_app && cd ~/test_app
Within the project directory, create a virtual environment using the venv
module:
python3.13 -m venv test_app_venv
Activate the virtual environment:
source test_app_venv/bin/activate
Your shell prompt will now be prefixed with the name of the virtual environment (e.g., (test_app_venv)
). Install a package, such as awscli
, using pip
:
pip3.13 install awscli
To deactivate the virtual environment, use the deactivate
command:
deactivate
Conclusion
As of February 2025, Python 3.13 is the latest stable release. AlmaLinux and Rocky Linux, being RHEL derivatives, typically include Python 3.9 by default. Installing Python 3.13 from source allows you to leverage the latest features without affecting the system’s default Python installation. The above steps provide a straightforward method to achieve this.
Please subscribe to us on Facebook, YouTube, and X.
Also, you may like to read the following articles:
Set up Python on Windows 11
Install Python 3.12 on Rocky Linux 8 AlmaLinux 8
Install Python 3.12 on RHEL 9
Set up Python 3.12 on Ubuntu and Debian
FAQs
Will installing Python 3.13 affect the system’s default Python version?
No, using make altinstall ensures that the new Python version is installed alongside the default one without replacing it. The system will continue to use the default Python interpreter unless you explicitly call Python 3.13 using python3.13.
How can I set Python 3.13 as the default Python interpreter?
It’s generally recommended to keep the system’s default Python version unchanged to avoid potential issues. However, for user-specific applications, you can modify your shell profile (.bashrc or .bash_profile) and set alias python to python3.13.
Alternative Solutions for Installing Python 3.13 on AlmaLinux and Rocky Linux
While building from source is a reliable method, it can be time-consuming and requires managing dependencies manually. Here are two alternative approaches to Install Python 3.13 on AlmaLinux and Rocky Linux:
1. Using a Software Collection Library (SCL)
SCLs provide a way to install and use multiple versions of software, including Python, without interfering with the system’s default packages. This approach is beneficial when you need specific Python versions for different projects.
-
Explanation: SCLs package software into self-contained environments. When activated, these environments modify the system’s environment variables to prioritize the software within the SCL. This allows you to run Python 3.13 without affecting other applications that rely on the system’s default Python.
-
Steps:
-
Enable the Software Collections repository:
sudo dnf install centos-release-scl -y
-
Install the desired Python version (if available) – Note: Python 3.13 might not be directly available as an SCL package yet. Check available collections using
dnf list available 'rh-python*'
or similar. If it is not available, this method won’t work directly for Python 3.13. If an earlier version like 3.11 or 3.12 is available, you could install that.# Example for installing Python 3.9 (replace with the actual SCL package name if 3.13 becomes available) sudo dnf install rh-python39 -y
-
Activate the Software Collection:
scl enable rh-python39 bash # Replace rh-python39 with the actual package name
This command activates the Python 3.9 environment for the current shell session. You can now use
python
,python3
, andpip
commands associated with the SCL-provided Python version. -
Deactivate the Software Collection:
To revert to the system’s default Python, simply exit the shell or run:
deactivate
-
-
Pros: Easier than building from source, manages dependencies, allows multiple Python versions.
-
Cons: Might not always have the latest Python version available. Requires using SCL-specific commands for activation and deactivation. Python 3.13 may not be packaged as an SCL.
2. Using a Package Manager like conda
(Anaconda or Miniconda)
Anaconda and Miniconda are popular package, dependency, and environment management systems for Python. They provide a convenient way to install Python 3.13 alongside other versions and manage dependencies within isolated environments.
-
Explanation: Conda creates isolated environments, each with its own Python interpreter and set of packages. This eliminates dependency conflicts and allows you to easily switch between different Python versions and project configurations.
-
Steps:
-
Download and install Miniconda: Download the appropriate Miniconda installer for Linux from the official website (https://docs.conda.io/en/latest/miniconda.html).
-
Run the installer:
bash Miniconda3-latest-Linux-x86_64.sh # Replace with the actual filename
Follow the on-screen instructions. Accept the license agreement and choose an installation location. It’s recommended to add Miniconda to your
PATH
during installation. -
Create a Conda environment with Python 3.13:
conda create -n py313 python=3.13
This command creates a new environment named
py313
with Python 3.13. -
Activate the environment:
conda activate py313
Your shell prompt will change to indicate that the
py313
environment is active. -
Install packages:
Use
conda install
orpip
(after installing pip withconda install pip
) to install packages within the environment. For example:conda install numpy pip install requests
-
Deactivate the environment:
conda deactivate
-
-
Pros: Easy environment management, wide range of available packages, simplifies dependency resolution, allows multiple Python versions.
-
Cons: Conda environments can be large, requires learning Conda-specific commands.
These alternative methods offer easier ways to manage Python versions and dependencies on AlmaLinux and Rocky Linux compared to building from source. The best choice depends on your specific needs and preferences.