$linuxjunkies
>

pip(1)

pip is the package installer for Python, used to install and manage Python packages from PyPI and other indexes.

UbuntuDebianFedoraArch

Synopsis

pip [OPTIONS] COMMAND [ARGS]...

Description

pip is the primary tool for installing Python packages and their dependencies. It downloads packages from the Python Package Index (PyPI) by default, but can also install from local files, git repositories, and custom indexes. pip manages package versions, handles dependencies automatically, and can create reproducible environments with requirements files.

Common workflows include installing single packages (pip install package-name), listing installed packages (pip list), and using requirements.txt files to manage project dependencies (pip install -r requirements.txt). pip can upgrade packages, uninstall them, and freeze the current environment state for reproducibility.

Common options

FlagWhat it does
installinstall packages or upgrade existing ones
-r, --requirement FILEinstall all packages listed in a requirements file
-U, --upgradeupgrade packages to the newest available version
--userinstall packages in user home directory instead of system-wide
-e, --editable PATHinstall in editable/development mode from local path or git URL
listlist installed packages and their versions
freezeoutput installed packages in requirements format for reproducibility
uninstallremove one or more packages
-y, --yesassume yes to all prompts (e.g., when uninstalling)
--index-url URLbase URL of Python Package Index (default: https://pypi.org/simple)
--no-cache-dirdisable pip cache to save disk space or force fresh downloads

Examples

install the requests library from PyPI

pip install requests

install all packages listed in requirements.txt, respecting version constraints

pip install -r requirements.txt

upgrade an already-installed package to its newest version

pip install -U requests

show all installed packages and their versions

pip list

save current environment's packages and exact versions to requirements.txt

pip freeze > requirements.txt

install directly from a git repository in editable mode for development

pip install -e git+https://github.com/user/repo.git#egg=package

remove the numpy package without prompting for confirmation

pip uninstall -y numpy

install flask in the user's local directory instead of system-wide

pip install --user flask

Related commands