DEV Community

Cover image for Installing Python and pip on Ubuntu 26.04
Sanskriti Harmukh for Vultr

Posted on • Originally published at docs.vultr.com

Installing Python and pip on Ubuntu 26.04

Ubuntu 26.04 ships Python 3.14 in its default APT repository, making it available without any external sources or version management overhead. This guide covers installing Python and pip, verifying the interpreter, and setting up virtual environments to keep project dependencies isolated from the system installation and from each other.


Install Python

Python 3.14 is available directly from Ubuntu 26.04's default APT repository.

1. Update the APT package index:

$ sudo apt update
Enter fullscreen mode Exit fullscreen mode

2. Install Python:

$ sudo apt install python3 -y
Enter fullscreen mode Exit fullscreen mode

3. Verify the installed version:

$ python3 --version
Enter fullscreen mode Exit fullscreen mode

Install pip

pip is the standard package manager for Python, used to install and manage packages from the Python Package Index.

1. Install pip:

$ sudo apt install python3-pip -y
Enter fullscreen mode Exit fullscreen mode

2. Verify the installed version:

$ pip3 --version
Enter fullscreen mode Exit fullscreen mode

Test the Python Interpreter

The interactive shell confirms the interpreter is installed and responding correctly.

$ python3
Enter fullscreen mode Exit fullscreen mode
>>> print("Hello, Python!")
Hello, Python!
>>> import sys; print(sys.version)
>>> exit()
Enter fullscreen mode Exit fullscreen mode

Create a Virtual Environment

Virtual environments provide isolated Python installations where each project maintains its own set of dependencies, preventing version conflicts across projects and protecting the system Python installation.

1. Install the venv module:

$ sudo apt install python3-venv -y
Enter fullscreen mode Exit fullscreen mode

2. Create a new virtual environment:

$ python3 -m venv example_env
Enter fullscreen mode Exit fullscreen mode

3. Activate the environment:

$ source example_env/bin/activate
Enter fullscreen mode Exit fullscreen mode

The prompt changes to (example_env) to indicate the environment is active.

4. Install a package inside the environment:

$ pip install requests
Enter fullscreen mode Exit fullscreen mode

5. List installed packages:

$ pip list
Enter fullscreen mode Exit fullscreen mode

6. Deactivate the environment:

$ deactivate
Enter fullscreen mode Exit fullscreen mode

The requests package remains scoped to example_env and does not affect any other project or the system Python installation.


Next Steps

Python and pip are now installed and ready for development. From here you can:

  • Use pipx to install CLI tools in isolated environments without affecting project dependencies
  • Try uv for faster package management and built-in virtual environment support
  • Set up a Jupyter Notebook server for interactive data science and analysis workflows

For the complete guide, visit the original article on Vultr Docs.

Top comments (0)