How to Install Python on Rocky Linux 8 (Step-by-Step)

How to Install Python on Rocky Linux 8 (Step-by-Step)
Eileen.B
11m
0 comments
Print
2025/08/18

Rocky Linux has quickly become a trusted choice for developers and also system administrators who need a stable and secure Linux distribution, one of its advantages is its compatibility with modern programming languages like Python, which is widely used in web development, data analysis, and machine learning, in this guide, we’ll walk through how to install and configure Python on Rocky Linux 8, while also sharing practical tips, common mistakes to avoid, and why certain steps matter, By the end, you won’t just have Python installed you’ll also understand how to keep your setup clean, flexible, and future-proof.

How to Configure Python on Rocky Linux 8

Why Developers Prefer Python on Rocky Linux 8?

Before getting started on setup, It is better to ask ourselves: why do people actually like using Python on Rocky Linux?

Server management: It’s handy and recommended for automating tasks such as backups, monitoring, and also deploying apps.

Data work: Python libraries like NumPy, Pandas, and TensorFlow run pretty smoothly on Rocky servers.

Web development: If you’ve tried Django or Flask, you’ll know they’re straightforward to spin up here.

Stability: Rocky Linux is built to last, so you don’t need to worry about your setup breaking every year.

Little tip: if you’re planning a production server, running Python on Rocky gives you the mix of stability + security, but you can still grab new features when you need them.

System Requirements Before Installing Python on Rocky Linux 8

Before starting, make sure you have:

Rocky Linux installed and running

A  non-root user with sudo permission

Internet connection

 Step 1: Update Rocky Linux Packages to Prevent Errors

Always update packages before installing new software to avoid conflicts:

sudo dnf -y update

Step 2: Install Python from Rocky Linux Repositories

Rocky Linux 8 includes Python in the AppStream repository, making installation simple:

sudo dnf install python3.13

Now you should type “Y” and then press Enter, which will start the installation process.

type "Y" and then press Enter

 

Step 3: Verify Python Installation on Rocky Linux 8

To verify the Python version, you need to run the following command.

python3.13 --version

Tip: If you only need a stable, supported version of Python, this method is best because it ensures easy updates through Rocky’s package manager.

After running the previous command, the installation of Python on your Rocky Linux system should be complete.

Verify Python version

Install Python from Source (For Latest Features)

Sometimes the repository version isn’t the newest,  If you want the absolute latest Python release or need multiple versions side by side, install from source.

Install Development Tools and Dependencies

sudo dnf groupinstall "Development Tools" -y
sudo dnf install openssl-devel libffi-devel bzip2-devel wget -y

Download and Extract Source 

wget https://www.python.org/ftp/python/3.13/Python-3.13 tar.xz
tar xvf Python-3.13 tar.xz
cd Pyhton-3.1

Configure and Install

./configure --enable-optimizations
sudo make altinstall

Why altinstall? Using “make install” would overwrite the system’s default Python (which Rocky uses internally), “altinstall” prevents breaking your OS.

Completing the above command may take a long time. When the Python installation is complete, you will receive the following message:

 install python on rocky linux

Check version:

python3.13 --version

After installing Python and all its dependencies, you can install your desired modules for Python. The requests module will be installed by entering the following command:

python3.13 -m pip install <module>

Remember to enter the name of your desired module instead of <module>.

You can see the modules installed on your server with the help of the following command:

python3.13 -m pip list

Output:

python modules list

How to Install the Latest Python Version from Source on Rocky Linux

First, you need to create a test file with your favorite text editor, such as vi or nano. To do this, run the following command:

cd Python-3.13
sudo nano hello.py

Now you need to copy the following code and paste it into your file:

print("NeuronVM, HelloWorld!")

Then save the changes and exit.

Next, you should run the program by entering the following command:

python3.13 hello.py

If there is no problem, finally you will get the following message.

NeuronVM, HelloWorld!

Common Issues and How to Fix Them

1- Error: ” pip not found ”

Fix: Run this command to install pip:

sudo dnf install python3.13-pip

2- Old Python version still showing

Fix: Use the specific version when running Python:

python3.13

My Personal Experience Installing Python on Rocky Linux 8

When I first tried installing Python on Rocky Linux, I went with the repository method because it looked easier to me, the installation itself was easy, just a couple of commands, but later, when I tried running a newer machine learning project, I needed to install it from the source, honestly, it took me longer than I expected because I messed up the “make install” step the first time, but at the end earned about using make altinstall so I wouldn’t break my system’s default Python, after that, it worked perfectly, and I could use multiple versions side by sid, so, if you’re just getting started, the repository version is more than enough, but if you’re into AI, or testing with newer Python features, compiling from source really makes sense,it felt a bit overwhelming at first, but once I figured it out, it wasn’t so bad.

Python Installation on Rocky Linux 8: Which Method Should You Choose?

Feature From Repositories From Source
Ease of Installation Very Simple More Complex
Python Version Stable but not the newest Always the newest version
System fit Works smoothly Stays separated
Updates Updates automatically You need to update manually
Flexibility Only one version at a time Can install and use many versions
Best for Beginners Developers
Possible issues Very safe A bit risky

Conclusion

Installing Python on Rocky Linux 8 is straightforward, but the method you choose depends on your needs, For simplicity and stability, use the repository version, for latest features and flexibility, you can easily compile from source, By combining Rocky Linux’s reliability with Python’s handiness, you get a powerful setup for development, and machine learning, With this guide, you not only installed Python, you also learned why each step matters, how to avoid common mistakes, and how to set up your environment like a pro.

Share this Post
Frequently Asked Questions

Yes, you can install other versions manually too.

Yes you can.

Eileen.B

Leave a reply

Calculate the value of (7 - 7) :

Save my name and email in this browser for the next time.

Last Comments

Show More
Rating: 0/5