How to Install Python 3.10 on Fedora Linux

Python is one of the most popular high-level languages, focusing on high-level and object-oriented applications from simple scrips to complex machine learning algorithms. Python 3.10 is the latest release and is not classed as stable compared the Python 3.9, but the final candidate is expected to be completed on the 4th of October 2021.

Some of the features Python can do:

  • Python can be used on a server to create web applications.
  • Python can be used alongside software to create workflows.
  • Python can connect to database systems. It can also read and modify files.
  • Python can be used to handle big data and perform complex mathematics.
  • Python can be used for rapid prototyping or production-ready software development.

For users and especially developers wanting to try out Python’s latest release, you will know how to install Python 3.10 on Fedora Linux at the end of this guide. The same principle will work on most versions of Fedora Linux.

Prerequisites

  • Recommended OS: Fedora Linux 34
  • User account: A user account with sudo or root access.

Updating Operating System

Update your Fedora Linux operating system to make sure all existing packages are up to date:

sudo dnf update && sudo dnf upgrade -y

Install Python 3.10 using DNF

To install the latest versions of Python 3.10 is a relatively straightforward process on Fedora Linux, given it’s an upstream version of Rhel that focuses on the newest package versions that are refreshed every 6 months.

First, make sure to check if the updates-testing repository is enabled:

sudo dnf install --enablerepo=updates-testing python3.10

Next, install Python 3.10 with the following command:

sudo dnf install python3.10

Example of packages that will be installed:

How to Install Python 3.10 on Fedora Linux

Type Y and then press the enter key to proceed with the installation.

Once complete, confirm the with checking the version as follows:

python3.10 --version

Example output:

[jjames@fedora ~]$ python3.10 --version
Python 3.10.0rc1

That’s it, and you have installed Python 3.10.

Install Python 3.10 on Fedora Linux from Source

The alternative option for those that feel up to more of a challenge or require certain advanced builds from the git repository of the source can opt to install directly from the source. The main issue with this method is that you cannot easily update the DNF package manager like you would and will need to recompile for any changes.

First, you will need to install the dependencies necessary to build Python 3.10:

sudo dnf install gcc openssl-devel bzip2-devel libffi-devel zlib-devel -y

The second part is visiting the downloads page on Python’s website and getting the latest version using (wget):

wget https://www.python.org/ftp/python/3.10.0/Python-3.10.0rc1.tar.xz

The file archive is small, so it won’t take a long time to download. Once done, extract the archive:

tar -xf Python-3.10.0rc1.tar.xz

You will need to switch to the source directory and run the configuration script, which does a basic run-through checklist to ensure all dependencies are present for the installation to work.

cd Python-3.10.0rc1.tar.xz && ./configure --enable-optimizations

Note, the (–enabled-optimizations) is recommended as it optimizes the Python binary by running multiple tests but takes extra time to compete. Overall the process should take a few minutes, so it’s recommended not to skip.

Example end output:

How to Install Python 3.10 on Fedora Linux

The next option is to use the (make) command to start the build process.

make -j 2

Note, the (-j) corresponds to the number of cores in your system to speed up the build time. If you have a powerful server, you can set this as high as you like. If you don’t, then it will be the default option of 1. To find out how many cores you have on your system, execute the following code:

nproc

Example output of cores LinuxCapable test operating system has:

How to Install Python 3.10 on Fedora Linux

As you can see, we have 2 cores, so in the (make) command, we used (-j 2).

In the last step, once you have finished with the build process, you will install Python 3.10 source by executing the following:

sudo make altinstall

Note, the guide has used (altinstall) instead of the default (install) because it will overwrite the default system python3 binary python binary file /usr/bin/python.

Check the version of the installation to make sure it has been installed successfully and its current build number:

python3.10 --version

Example output:

[jjames@fedora ~]$ python3.10 --version
Python 3.10.0rc1

Comments and Conclusion

The guide has shown you how to install the latest version of Python 3.10 on your Fedora Linux operating system in using either the testing repository of Fedora or installing by compiling the latest Python release source files.



Follow LinuxCapable.com!

Like to get automatic updates? Follow us on one of our social media accounts!