FedoraRHEL Based

How To Install Python on Fedora 43

Install Python on Fedora 43

Python remains one of the most versatile programming languages in modern software development. Whether you’re building web applications, analyzing data, or automating system tasks, Python on Fedora 43 provides the foundation for countless projects. Fedora 43, as a cutting-edge Linux distribution, offers excellent support for the latest Python 3.14 release, making it an ideal platform for developers and system administrators. This comprehensive guide walks you through multiple installation methods, configuration steps, and best practices to get Python running on your Fedora 43 system.

Understanding Python and Fedora 43

What is Python?

Python is a high-level, interpreted programming language known for its simple syntax and powerful capabilities. The language powers numerous applications across web development, data science, machine learning, system administration, and artificial intelligence. Python’s popularity stems from its readability, extensive standard library, and massive ecosystem of third-party packages. For Linux users specifically, Python serves as the backbone for countless system utilities, administrative scripts, and modern development frameworks.

The language supports multiple programming paradigms including procedural, object-oriented, and functional programming styles. This flexibility makes Python suitable for beginners learning to code and experienced developers tackling complex projects. Real-world applications include Django and Flask web frameworks, NumPy and Pandas for data analysis, TensorFlow for machine learning, and countless automation tools.

Fedora 43: An Overview

Fedora represents a community-driven Linux distribution maintained by the Fedora Project and sponsored by Red Hat. Unlike enterprise-focused distributions like RHEL, Fedora prioritizes cutting-edge technologies and frequent releases. Fedora 43 continues this tradition by shipping with Python 3.14, the latest stable release. This release cycle ensures developers have access to the newest language features, performance improvements, and security patches.

The distribution’s commitment to open-source principles and rapid innovation makes it perfect for Python development environments. Fedora 43 includes modern development tools, comprehensive package management through DNF, and excellent community support for Python projects. The operating system comes pre-configured with many development essentials, reducing setup time significantly.

Pre-installed Python on Fedora

Fedora 43 ships with Python 3 pre-installed by default. This built-in Python installation handles system-level tasks and serves as the foundation for additional Python development. Understanding this pre-installed version helps prevent conflicts and ensures system stability during setup.

The pre-installed Python 3 installation typically represents the stable version supported throughout that Fedora release cycle. System tools, package managers, and administrative utilities rely on this default Python version. Therefore, preserving the system Python protects your operating system’s functionality and stability.

Pre-Installation Requirements and System Preparation

System Requirements

Before beginning Python installation on Fedora 43, verify that your system meets basic requirements. The process requires minimal hardware resources. Any modern computer with at least 1 GB RAM and 500 MB free disk space handles Python installation without difficulty.

Internet connectivity is essential for downloading packages through DNF or fetching source code. A stable connection prevents installation interruptions and ensures proper dependency resolution. Administrator access via sudo privileges enables system-level package installation.

Verifying Your Fedora Installation

Start by confirming your Fedora 43 installation. Open a terminal and execute this command to check your system version:

cat /etc/fedora-release

This command displays your Fedora release number. You should see output indicating Fedora 43 or later. Keep your system updated before installing Python to avoid dependency conflicts and security vulnerabilities.

Run the system update command:

sudo dnf update -y

The -y flag automatically confirms the installation of all updates without prompting. This process refreshes your package repository metadata and installs available system patches. Updates may take several minutes depending on system performance and internet speed.

After updates complete, verify your existing Python installation by checking its version:

python3 --version

This command displays the default Python 3 version already installed on your system. Most Fedora 43 installations include Python 3.13 or 3.14. Recording this version prevents confusion when managing multiple Python installations later.

Opening the Terminal

The terminal application provides the command-line interface needed for Python installation. On GNOME desktop environments, press Alt + F1 to open the Activities menu. Type “terminal” in the search bar and select the Terminal application.

Alternatively, right-click on the desktop and select “Open Terminal Here” if your desktop environment supports this option. Some users prefer keyboard shortcuts like Ctrl + Alt + T, which opens the terminal immediately on many desktop configurations.

Method 1: Installing Python Using DNF (Package Manager)

Why DNF is the Best Method

DNF (Dandified Yum) serves as Fedora 43’s default package manager. This approach represents the simplest and most recommended way to install Python for most users. DNF automatically handles dependency resolution, ensuring all required libraries install correctly.

The package manager approach offers several advantages over manual compilation. Official packages receive security updates automatically through system maintenance routines. Installation completes in minutes rather than hours. DNF prevents broken dependencies and version conflicts that might occur with manual installations.

From a practical standpoint, DNF packages integrate seamlessly with Fedora’s package ecosystem. System managers can easily track installed software, update packages, and remove unwanted installations. This method suits production environments, development machines, and learning platforms equally well.

Step-by-Step Installation Using DNF

The DNF installation method requires only a few commands to complete. First, open your terminal and ensure your package lists are current:

sudo dnf update -y

This command refreshes your local package metadata, ensuring you install the latest available versions. Next, install Python 3 using this command:

sudo dnf install python3 -y

The system displays installation progress as it downloads the Python package and all dependencies. The process typically completes within one to two minutes on standard internet connections. You should see a confirmation message indicating successful installation once the command finishes.

Verifying DNF Installation

After installation completes, verify the successful setup immediately. Check the Python version installed:

python3 --version

This command displays the installed Python version number. You should see output like “Python 3.14.0” or similar, confirming successful installation.

Test the Python interactive shell to verify full functionality:

python3

This command launches the Python interactive interpreter, showing the Python prompt (>>>). Type a simple test command:

>>> print("Python is installed successfully on Fedora 43")

Press Enter to execute the command. The message prints to confirm everything works correctly. Exit the Python shell by typing:

>>> exit()

Installing Specific Python Versions

Fedora repositories often include multiple Python versions alongside the default installation. This feature allows developers to work with specific Python versions required by their projects. Install alternative versions using DNF:

sudo dnf install python3.11 -y
sudo dnf install python3.10 -y
sudo dnf install python3.9 -y

Each command installs the specified Python version independently. These versions coexist peacefully without conflicts, allowing you to switch between versions as projects require. Verify multiple installations using version checks for each:

python3.11 --version
python3.10 --version
python3.9 --version

This capability proves invaluable for developers supporting legacy projects requiring older Python versions or testing code across multiple Python releases.

Method 2: Building Python From Source

When to Build From Source

Building Python from source code provides maximum flexibility and control over the installation. This method suits scenarios where you need specific compilation options, require the absolute latest Python version before official package releases, or want to optimize Python for particular hardware.

However, compiling from source requires more time and technical expertise than DNF installation. The process takes 15-30 minutes depending on system performance. This method suits experienced users and specialized deployment scenarios rather than typical development setups.

Installing Development Tools and Dependencies

Building from source requires development tools and libraries not included in standard Fedora installations. Install the development tools group first:

sudo dnf groupinstall "Development Tools" -y

This command installs the GCC compiler, make utility, and other essential build tools. The installation downloads several packages and may take a few minutes.

Next, install Python-specific dependencies. These libraries enable Python to support various features:

sudo dnf install python3-devel openssl-devel zlib-devel bzip2-devel sqlite-devel libffi-devel -y

Each dependency serves a specific purpose. OpenSSL enables secure network connections. Zlib provides compression support. SQLite allows database functionality. LibFFI enables Python’s ctypes module for calling C libraries.

Downloading Python Source Code

Visit the official Python website to obtain the source code:

cd ~
wget https://www.python.org/ftp/python/3.9.25/Python-3.9.25.tgz

Replace “3.14.0” with your desired version number. The wget command downloads the compressed source archive to your home directory. The file size typically ranges from 20-30 MB. Monitor the download progress, which depends on your internet connection speed.

Extracting and Compiling

Extract the downloaded archive:

tar xzf Python-3.9.25.tgz
cd Python-3.9.25

The tar command decompresses the file and creates a directory containing the source code. The cd command changes to this directory, where all subsequent compilation commands execute.

Configure the build with optimization flags:

./configure --enable-optimizations --with-ensurepip=install

The --enable-optimizations flag enables performance optimizations that slightly extend compilation time but produce faster Python executables. The --with-ensurepip=install flag ensures pip installs automatically during compilation.

The configuration process analyzes your system and prepares the build environment. This step takes one to two minutes. Once configuration completes, begin compilation:

make

This command compiles the entire Python source code. The process requires significant CPU resources and typically takes 10-20 minutes on modern systems. The terminal displays compilation progress, showing files being compiled and any warnings encountered.

Installation and Post-Compilation

After compilation completes successfully, install the compiled Python:

sudo make altinstall

Critical: Always use altinstall instead of install. The altinstall command preserves your system Python installation, preventing potential system breakage. The regular install command replaces the default Python, which could damage system tools that depend on specific Python versions.

Installation creates symbolic links and copies files to system directories. This step requires administrator privileges, hence the sudo prefix. Once installation completes, verify the new Python installation:

/usr/local/bin/python3.9.25 --version

The full path ensures you’re checking the newly compiled version rather than the system default. Clean up the source files to save disk space:

cd ~
rm -rf Python-3.9.25

Installing Essential Python Tools and Components

Installing pip (Python Package Manager)

pip enables installation of third-party Python packages from the Python Package Index (PyPI). This tool is essential for any Python development environment. Install pip using DNF:

sudo dnf install python3-pip -y

Verify pip installation:

pip3 --version

The output displays the installed pip version and associated Python version. Upgrade pip to the latest version:

pip3 install --upgrade pip

This command ensures you have the newest pip features and bug fixes. pip’s role in Python development cannot be overstated. It simplifies dependency management, enables reproducible environments, and connects your projects to thousands of available libraries.

Setting Up Virtual Environments

Virtual environments create isolated Python environments for different projects. Each environment maintains separate package installations, preventing version conflicts between projects. Install the virtualenv tool:

sudo dnf install python3-virtualenv -y

Create a virtual environment for your project:

python3 -m venv myproject_env

This command creates a directory containing an isolated Python installation. Activate the environment:

source myproject_env/bin/activate

After activation, the prompt changes to show the environment name, indicating the active virtual environment. Any packages installed now go into this isolated environment, not affecting your system Python or other projects.

Deactivate the environment when finished working:

deactivate

This command returns you to the system Python environment. Virtual environments prevent “dependency hell” where projects require conflicting package versions. Professional developers consistently use virtual environments for all Python projects.

Essential Python Libraries and Tools

Many Python projects depend on common libraries. Install frequently used packages within your virtual environment:

pip install numpy pandas requests flask django

NumPy provides numerical computing capabilities. Pandas offers data manipulation and analysis tools. Requests simplifies HTTP requests. Flask and Django are web development frameworks. Installing these libraries within a virtual environment ensures project portability.

Setting Up Your Python Development Environment

Choosing an IDE or Text Editor

An Integrated Development Environment (IDE) or text editor significantly enhances productivity. IDEs provide debugging tools, code completion, integrated terminals, and project management features. Different tools suit different preferences and project types.

Visual Studio Code offers lightweight features with extensive extension support. PyCharm provides comprehensive Python-specific tools through both free Community Edition and paid Professional versions. Sublime Text delivers a minimal, fast alternative preferred by some developers. Vim and Nano provide command-line options for remote development or minimal environments.

Installing Visual Studio Code

Visual Studio Code represents an excellent free choice for Python development. First, add the VS Code repository:

sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
echo '[code]
name=Visual Studio Code
baseurl=https://packages.microsoft.com/yumrepos/vscode
enabled=1
gpgcheck=1
gpgkey=https://packages.microsoft.com/keys/microsoft.asc' | sudo tee /etc/yum.repos.d/vscode.repo > /dev/null

Update your package manager:

sudo dnf update

Install VS Code:

sudo dnf install code

After installation, launch VS Code from your application menu or terminal by typing code. Install the official Python extension from Microsoft within VS Code for syntax highlighting, debugging, and IntelliSense.

Installing PyCharm

PyCharm offers powerful Python-specific development features. Download PyCharm Community Edition from the official JetBrains website. Extract the archive and navigate to the bin directory:

tar xzf pycharm-community-*.tar.gz
cd pycharm-community-*/bin
./pycharm.sh

PyCharm launches with an initial setup wizard. Configure interpreter paths and create your first project. The professional version offers additional features like Django support and remote development capabilities but requires a paid subscription.

Verifying Installation and Testing Your Setup

Comprehensive Installation Verification

After completing installations, verify everything works correctly. Check all Python versions:

python3 --version
python3.11 --version

Check pip functionality:

pip3 --version
pip list

The pip list command displays all installed packages. Verify your virtual environment setup:

python3 -m venv test_env
source test_env/bin/activate
pip list
deactivate

This quick test confirms virtual environment isolation by showing different package lists before and after activation.

Running Your First Python Program

Create a test Python file to verify end-to-end functionality. Open your terminal and create a new file:

nano first_program.py

Type this code into the editor:

#!/usr/bin/env python3

print("Python is successfully installed on Fedora 43!")

# Simple calculation
result = 5 + 3
print(f"5 + 3 = {result}")

# List comprehension
squares = [x**2 for x in range(1, 6)]
print(f"Squares of 1-5: {squares}")

Save the file by pressing Ctrl + X, then Y, then Enter. Execute the script:

python3 first_program.py

The output confirms successful Python installation and functionality. You now have a fully operational Python environment on Fedora 43.

Troubleshooting Common Installation Issues

DNF Installation Problems

Occasionally, DNF installation encounters issues. If you receive “Package not found” errors, ensure your repositories are enabled:

sudo dnf repolist

This command lists all enabled repositories. If Python packages don’t appear, enable the appropriate repository and try again.

Dependency conflicts sometimes prevent installation. Try resolving with:

sudo dnf install --allowerasing python3

This command allows DNF to remove conflicting packages automatically. Use this cautiously, as it might remove other packages.

Permission and Access Errors

“Permission denied” errors typically indicate missing sudo privileges. Always precede system-level installation commands with sudo. For user-level pip installations in virtual environments, omit sudo:

pip install package_name

Version Compatibility Issues

When multiple Python versions exist on your system, conflicts may arise. Use Fedora’s alternatives system to set default versions:

sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.14 1
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 2
sudo update-alternatives --config python3

This setup allows selecting between versions interactively. The number at the end sets priority (higher numbers take precedence).

Missing Dependency Errors

If compilation fails with missing library errors, install the specific development package:

sudo dnf install package_name-devel

Replace “package_name” with the missing dependency name. Common examples include ssl-devel, zlib-devel, or readline-devel.

Best Practices for Python on Fedora 43

Security Considerations

Keep Python updated regularly. Enable automatic security updates:

sudo dnf install dnf-automatic
sudo systemctl enable dnf-automatic-install.timer

Virtual environments provide security isolation by preventing system-wide package conflicts. Always audit dependencies before installation:

pip check

This command identifies dependency conflicts and vulnerabilities.

System Python vs. User Python

Never modify the system Python installation directly. Always use virtual environments for development. The system relies on specific Python versions for administrative tools and system utilities. Modifying system Python can break critical functionality.

When working on projects, always activate the appropriate virtual environment first. This prevents accidentally installing packages globally, which could affect other projects or system stability.

Regular Maintenance

Keep your Python installation current. Monthly updates ensure security patches and performance improvements:

sudo dnf update python3

Remove old virtual environments you no longer need:

rm -rf old_project_env

Clean pip cache periodically:

pip cache purge

Congratulations! You have successfully installed Python. Thanks for using this tutorial for installing Python programming language on your Fedora 43 Linux system. For additional or useful information, we recommend you check the official Python website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button