How to Install Python and pip on Ubuntu 26.04

Updated on 24 April, 2026
Install Python programming language and pip package manager on an Ubuntu 26.04 for web development, automation, data analysis, and scripting.
How to Install Python and pip on Ubuntu 26.04 header image

Python is a general-purpose programming language used for web development, automation, data analysis, and system scripting. pip is the default package manager for Python that installs and manages third-party libraries from the Python Package Index (PyPI).

This article explains how to install Python and pip on an Ubuntu 26.04 server, test the installation with an interactive session, and set up isolated development environments using virtual environments.

Prerequisites

Before you begin, you need to:

Install Python

Ubuntu 26.04 includes Python in the default APT repositories. The following steps install the latest available Python version and verify the installation.

  1. Update the APT package index.

    console
    $ sudo apt update
    
  2. Install Python.

    console
    $ sudo apt install python3 -y
    
  3. Confirm the installed Python version.

    console
    $ python3 --version
    

    Your output should be similar to the one below:

    Python 3.14.3

Install pip

pip enables installation of Python packages from PyPI and other repositories. The following steps install pip and verify the installed version.

  1. Install the pip package manager.

    console
    $ sudo apt install python3-pip -y
    
  2. Confirm the installed pip version.

    console
    $ pip3 --version
    

    Your output should be similar to the one below:

    pip 25.1.1 from /usr/lib/python3/dist-packages/pip (python 3.14)

Test Python

The Python interactive shell allows you to execute code directly in the terminal. The following steps verify that the Python interpreter is working correctly.

  1. Open the Python interactive shell.

    console
    $ python3
    
  2. Run a test command.

    python
    >>> print("Hello, Python!")
    

    The interpreter returns:

    Hello, Python!
  3. Exit the interactive shell.

    python
    >>> exit()
    

Create Virtual Environments

Virtual environments provide isolated Python installations where each project maintains its own set of dependencies without affecting the system-wide packages. The venv module is included with Python and creates lightweight virtual environments.

  1. Install the python3-venv package.

    console
    $ sudo apt install python3-venv -y
    
  2. Create a new virtual environment. For example, example_env.

    console
    $ python3 -m venv example_env
    
  3. Activate the virtual environment.

    console
    $ source example_env/bin/activate
    

    The terminal prompt changes to indicate the active environment:

    (example_env) user@server:~$
  4. Install a sample package inside the virtual environment using pip. For example, requests.

    console
    $ pip install requests
    
  5. Verify the installed package.

    console
    $ pip list
    

    The output lists all packages installed in the virtual environment, including requests and its dependencies.

  6. Deactivate the virtual environment to return to the system Python.

    console
    $ deactivate
    

Conclusion

You have installed Python and pip on an Ubuntu 26.04 server and created an isolated virtual environment for managing project-specific dependencies. Virtual environments prevent package conflicts between projects and provide reproducible development setups. For more information, refer to the official Python documentation.

Comments