Install Python on Arch Linux from the official python package when you need CPython for development, automation, data work, or project tooling. Minimal Arch installations do not include Python by default, but the repository package provides both python and python3, while python-pip, python-pipx, and uv cover project libraries, isolated command-line tools, and alternate-version workflows.
Update Arch Linux Before Python Installation
Synchronize package databases and upgrade installed packages before installing new software. Arch Linux is a rolling release distribution, so regular updates prevent dependency conflicts:
sudo pacman -Syu
These commands use
sudofor tasks that need root privileges. If your user is not in the sudoers file yet, run the commands as root or follow the guide on how to add and manage sudo users on Arch Linux.
Install Python on Arch Linux via pacman
The official Arch Linux python package is in the core repository. It includes the CPython interpreter, the standard library, the interactive REPL shell, and the python3 command readers often search for separately.
Install the Python Package
Install Python using pacman:
sudo pacman -S python
Pacman lists optional dependencies during installation. These are not required for the interpreter, but they extend common Python workflows:
python-pip: The package installer for Python (covered in the next section)python-pipx: Installs Python CLI applications in isolated environmentspython-setuptools: Build system for Python packagessqliteandxz: Optional standard-library integrations for SQLite databases and LZMA compressiontk: Required for thetkinterGUI module
Verify the Python Installation
Confirm Python is installed and check the current rolling-release version:
python --version
Relevant output starts with the installed Python branch. The exact version changes as Arch updates:
Python 3.14.x
Verify the interpreter paths using command -v. The which utility is not installed by default on minimal Arch systems:
command -v python
command -v python3
/usr/bin/python /usr/bin/python3
Use pacman ownership checks when you need to prove which package provides /usr/bin/python3:
pacman -Qo /usr/bin/python /usr/bin/python3
/usr/bin/python is owned by python 3.14.x-1 /usr/bin/python3 is owned by python 3.14.x-1
Check that key standard library modules are accessible, including venv for project environments:
python -c "import venv, sqlite3, ssl, json, compression.zstd; print('Core modules: OK')"
Core modules: OK
Test the Interactive Python Shell
Python includes an interactive REPL (Read-Eval-Print Loop) for quick testing and exploration. Launch it by running python with no arguments:
python
Python 3.14.x (main, ...) [GCC ...] on linux Type "help", "copyright", "credits" or "license" for more information. >>>
Try a quick calculation or import to confirm everything works, then exit with exit() or Ctrl+D:
>>> import sys
>>> print(f"Python {sys.version}")
>>> exit()
Install pip and Python Package Tools on Arch Linux
Python’s package installer appears in two places on Arch Linux. The base python package can seed pip inside virtual environments, but it does not install the global /usr/bin/pip or /usr/bin/pip3 commands. Install python-pip when you need those commands outside a project environment, then choose the tool based on what you are installing.
| Tool | Package | Purpose | Best For |
|---|---|---|---|
| pip | python-pip | Install libraries inside virtual environments | Project dependencies and tutorials that expect pip |
| pipx | python-pipx | Install Python CLI applications in isolated environments | User-wide tools such as black, httpie, poetry, and similar commands |
| uv | uv | Fast package installer, virtual environment manager, tool runner, and Python version manager | Developers who want one fast workflow for environments, tools, and alternate interpreters |
Use pip inside a virtual environment for project libraries, pipx for Python applications you want on your shell PATH, and uv when you intentionally want a faster all-in-one workflow.
Install pip
Install pip from the official repositories:
sudo pacman -S python-pip
The python-pip package provides both pip and pip3 on Arch Linux. If a tutorial says to install pip3, use python-pip instead of searching for a separate pip3 package.
command -v pip
command -v pip3
/usr/bin/pip /usr/bin/pip3
Verify the installation:
pip --version
pip 26.x from /usr/lib/python3.14/site-packages/pip (python 3.14)
Install pipx (Optional)
pipx installs Python-based command-line tools into their own isolated virtual environments while making the commands available on your user PATH. This is ideal for tools like code formatters, linters, and utilities that you want available in your shell without polluting the system Python environment:
sudo pacman -S python-pipx
Verify pipx is accessible:
pipx --version
1.x.x
Add the pipx binary path to your user shell so installed tools are available from your PATH:
pipx ensurepath
Open a new terminal, or source your shell configuration when the command tells you which file to reload. You can then install CLI tools with pipx install <tool>, for example pipx install black for the Black formatter.
Install uv (Optional)
uv is a fast Python package and project manager written in Rust. It can create virtual environments, install packages, run tools, and manage alternate Python versions from one command, and it is available in the official Arch Linux repositories:
sudo pacman -S uv
Verify the installation:
uv --version
uv 0.x.x (... x86_64-unknown-linux-gnu)
The uv workflow appears in the virtual environments section.
Create Python Virtual Environments on Arch Linux
Virtual environments isolate project dependencies so packages installed for one project do not interfere with another project or with packages managed by pacman. The venv module is included in Arch’s python package, so there is no separate python3-venv package to install. A new venv also gets its own pip, even when the global pip command is absent.
Arch Linux marks the system Python environment as externally managed under the PyPA externally managed environments specification. After
python-pipis installed, runningpip installagainst the system environment fails with anexternally-managed-environmenterror, which prevents pip from overwriting packages managed by pacman.
Create a Virtual Environment with venv
The built-in venv module creates lightweight virtual environments without any additional packages. Create a new project directory and a virtual environment inside it:
mkdir -p ~/my-python-project && cd ~/my-python-project
python -m venv .venv
The .venv directory name is a widely adopted convention. Using a dot-prefixed name keeps the environment directory hidden from normal ls output and excluded by most .gitignore templates.
Activate the virtual environment:
source .venv/bin/activate
Your shell prompt changes to show the active environment name:
(.venv) [user@hostname my-python-project]$
While the virtual environment is active, pip install works normally and installs packages only inside the .venv directory. Verify with:
python -m pip install requests
python -c "import requests; print('requests import OK')"
requests import OK
Deactivate the virtual environment when you are done working on the project:
deactivate
Create a Virtual Environment with uv
If you installed uv, it provides a faster alternative to python -m venv and pip for creating environments and installing packages. Create a project with a virtual environment:
mkdir -p ~/my-uv-project && cd ~/my-uv-project
uv venv
Using CPython 3.14.x interpreter at: /usr/bin/python Creating virtual environment at: .venv Activate with: source .venv/bin/activate
Activate and install packages:
source .venv/bin/activate
uv pip install flask
uv keeps environment creation and package installation under one command family, with a Rust implementation and shared cache that can make repeated installs faster depending on the package set and network.
Create a Virtual Environment with virtualenv
The virtualenv package provides additional features over the built-in venv module, including faster environment creation through seed caching and the ability to create environments with different Python versions. Install it from the official repositories:
sudo pacman -S python-virtualenv
Create and activate a virtual environment:
mkdir -p ~/my-virtualenv-project
virtualenv ~/my-virtualenv-project/.venv
source ~/my-virtualenv-project/.venv/bin/activate
The workflow inside the environment is the same: use pip install to add packages and deactivate to exit.
Install Python Packages on Arch Linux
Python packages can be installed through multiple channels on Arch Linux. The right method depends on whether you need a system-wide tool, a project-specific library, or a standalone CLI application.
Install Packages via pacman (System-Wide)
The official repositories contain pre-built Python packages with the python- prefix. This is the preferred method for system-wide packages because pacman handles dependencies and updates automatically:
pacman -Ss '^python-' | head -20
Install specific packages with pacman, for example:
sudo pacman -S python-requests python-numpy
Commonly available Python packages in the Arch repositories include:
python-requests: HTTP library for APIs and web requestspython-numpy: Numerical computing and array operationspython-flask: Lightweight web application frameworkpython-django: Full-featured web frameworkpython-sqlalchemy: SQL toolkit and ORMpython-pillow: Image processing library
Install Packages via pip (Inside Virtual Environments)
For packages not available in the Arch repositories or when you need a specific project version, use pip inside a virtual environment. This keeps project dependencies separate from Arch’s externally managed system Python:
python -m venv .venv && source .venv/bin/activate
python -m pip install package-name
To save your project’s dependencies for reproducibility:
pip freeze > requirements.txt
Recreate the environment on another system or after a fresh install:
python -m pip install -r requirements.txt
Install CLI Tools via pipx (User-Wide Isolated)
Use pipx for Python-based command-line tools you want available from your user shell without affecting your project environments. Each tool gets its own isolated virtual environment automatically:
pipx install black
pipx install httpie
pipx install poetry
List installed pipx tools with pipx list, upgrade all tools with pipx upgrade-all, and remove one with pipx uninstall <tool> when you no longer need it.
Test Your Python Installation on Arch Linux
Verify that Python can create, compile, and execute scripts by building a simple test program.
Create a Test Script
Create a file named hello.py:
nano hello.py
Add the following Python code:
#!/usr/bin/env python3
import sys
import platform
print("Hello, World!")
print(f"Python version: {sys.version}")
print(f"Platform: {platform.system()} {platform.machine()}")
The shebang line #!/usr/bin/env python3 locates the Python interpreter from the system PATH, making the script portable across different installations and virtual environments.
Save the file with Ctrl+O, press Enter, then exit with Ctrl+X.
Run the Script
Make the script executable and run it:
chmod +x hello.py
./hello.py
Relevant output should confirm the script ran. Version and build details vary with Arch updates:
Hello, World! Python version: 3.14.x (main, ...) [GCC ...] Platform: Linux x86_64
Alternatively, run the script directly with the Python interpreter:
python hello.py
Manage Multiple Python Versions on Arch Linux
Arch Linux installs one system-wide Python branch through pacman, and that branch tracks the rolling release package. The official repositories do not provide packages such as python312, python313, python3.12, or python3.13 for old branches. If a project needs an older interpreter, use a current AUR package after reviewing its PKGBUILD, or use uv to manage a standalone interpreter in your home directory.
Install Other Python Versions from the AUR
The Arch User Repository (AUR) currently provides community packages such as python313 and python312. These install separate binaries such as python3.13 or python3.12 beside the system Python instead of replacing /usr/bin/python or /usr/bin/python3.
Install an AUR-provided Python version using an AUR helper such as paru. This example installs the current Python 3.13 AUR branch:
paru -S python313
After installation, the version-specific binary is available alongside the system Python:
python3.13 --version
Create a virtual environment with the specific Python version:
python3.13 -m venv .venv-313
source .venv-313/bin/activate
AUR packages are community-maintained. Install
base-develandgitfirst withsudo pacman -S --needed base-devel git, then review the PKGBUILD before installing. If you do not have an AUR helper installed, follow the guide on how to install paru on Arch Linux, how to install yay on Arch Linux, or how to install pikaur on Arch Linux.
Manage Python Versions with uv
If you installed uv, it can download and manage multiple Python versions without requiring AUR packages. List available Python versions:
uv python list | head -10
The list can include alpha, release-candidate, and freethreaded builds. Choose a stable branch such as 3.12 unless your project specifically needs a preview interpreter.
Install a specific Python version:
uv python install 3.12
Create a virtual environment pinned to that version:
uv venv --python 3.12
uv downloads standalone CPython builds from the python-build-standalone project and stores managed interpreters under ~/.local/share/uv/python/. Its cache lives under ~/.cache/uv, and these files remain separate from the system Python managed by pacman.
Troubleshooting Python on Arch Linux
pip install Fails with “externally-managed-environment”
Error: Running pip install <package> outside a virtual environment produces this error:
error: externally-managed-environment
× This environment is externally managed
╰─> To install Python packages system-wide, try 'pacman -S
python-xyz', where xyz is the package you are trying to
install.
Cause: Arch Linux marks the system Python as externally managed to prevent pip from overwriting packages installed by pacman, which can break system tools.
Fix: Create a virtual environment and install packages there:
python -m venv .venv && source .venv/bin/activate
python -m pip install package-name
If you need the package available system-wide, check whether it exists in the Arch repositories with pacman -Ss python-<package> and install it with pacman instead. The longer error text also points Python applications toward pipx, which keeps each tool isolated from the system interpreter.
Module Not Found After Python Version Update
Error: After a system update that bumps the Python version (for example, from 3.13 to 3.14), scripts fail with ModuleNotFoundError: No module named 'module_name'.
Cause: Python packages are installed into version-specific directories like /usr/lib/python3.13/site-packages/. When the system Python updates to a new minor version, those directories change and previously installed packages are no longer visible.
Fix: Rebuild virtual environments after a Python minor version update:
rm -rf .venv
python -m venv .venv && source .venv/bin/activate
python -m pip install -r requirements.txt
For AUR packages that depend on a specific Python version, rebuild them after the update. List affected packages with:
pacman -Qoq /usr/lib/python3.13
Replace 3.13 with the previous Python version number to find packages that need rebuilding.
tkinter ImportError
Error: import tkinter fails with ImportError: libtk8.6.so: cannot open shared object file.
Cause: The tk package is listed as an optional dependency and is not installed with the base python package.
Fix: Install the Tk toolkit:
sudo pacman -S tk
Verify tkinter works:
python -c "import tkinter; print('tkinter: available')"
tkinter: available
Remove Python from Arch Linux
Do not remove the base
pythonpackage while other packages require it. On real Arch systems, Python often becomes a dependency of desktop, networking, monitoring, or administration packages. If pacman reports required packages, keep Python installed or remove those dependent packages intentionally first.
Check whether another installed package depends on Python before attempting to remove the interpreter:
pacman -Qi python | grep -E '^(Required By|Optional For)'
If Required By lists packages, do not force removal with dependency-breaking flags. If it says None and you are sure no local scripts need the interpreter, remove Python with:
sudo pacman -Rns python
The -Rns flags remove the package (-R), orphaned dependencies (-s), and configuration backup files (-n).
If you only want to remove optional Python tooling, leave the base interpreter alone and remove only the tool packages you installed. Adjust this package list to match your system:
sudo pacman -Rns python-pip python-pipx python-virtualenv uv
If you installed tk only for tkinter support, preview its removal separately before removing it. Keep it installed if the preview includes packages you still use:
sudo pacman -Rs tk --print
If the preview is acceptable, remove the package without a recursive cleanup sweep:
sudo pacman -R tk
If you used pipx and want to remove its installed applications as well, uninstall them before removing python-pipx:
pipx list
pipx uninstall-all
Verify package removal with pacman installed-state checks:
pacman -Q python-pip python-pipx python-virtualenv uv
pacman -Q tk
Pacman prints error: package 'package-name' was not found for each package that is no longer installed. If you kept tk, its installed package line should still appear.
The following commands permanently delete user-installed Python packages, pipx state, uv-managed Python versions, and uv caches stored under your home directory. These directories are not removed by pacman. Back up anything you want to keep before running them.
rm -rf ~/.local/lib/python*
rm -rf ~/.local/share/pipx
rm -rf ~/.local/state/pipx
rm -rf ~/.cache/pipx
rm -rf ~/.local/share/uv
rm -rf ~/.cache/uv
Conclusion
Python is installed on Arch Linux from the official python package, with python and python3 owned by pacman, pip available for virtual environments, and pipx or uv available when those workflows fit better. For database-driven projects, pair Python with PostgreSQL, MariaDB, or SQLite on Arch Linux. For containerized Python work, follow the guide on installing Docker on Arch Linux, and use the Arch Wiki Python documentation for deeper Arch-specific Python behavior.


Formatting tips for your comment
You can use basic HTML to format your comment. Useful tags currently allowed in published comments:
<code>command</code>command<strong>bold</strong><em>italic</em><blockquote>quote</blockquote>