pip
termKept in this browser · My desk
The package installer for Python, which installs packages from the Python Package Index and other indexes into the environment of the interpreter that runs it.
Run it as python -m pip, so that the interpreter, and with it the environment, is explicit. Each virtual environment gets its own copy, bootstrapped by ensurepip, so updating Python does not update the pip inside environments that already exist; the Python 3.13.17 release notes of October 2026 asked users to upgrade pip in every existing environment for that reason. pip's documentation warns that by default it does not protect against remote tampering and runs code from distributions; --require-hashes and --only-binary :all: change that.
The name is its own description. On 28 October 2008 Ian Bicking announced that he had finished renaming his installer pyinstall to pip, and explained the new name as an acronym and a declaration: pip installs packages. The project's documentation still opens with the same sentence in other words, the package installer for Python, used to install from the Python Package Index (PyPI) and other indexes. That scope is the first thing to get right. pip installs, removes and lists distributions in one Python environment; it does not create environments (venv does), does not install or select Python versions, and by its own account does not verify what it installs unless told to.
pip is not part of the standard library, yet almost every Python has it. PEP (Python Enhancement Proposal) 453, written by Donald Stufft and Alyssa Coghlan and created on 10 August 2013, made pip the officially recommended installer and had Python 3.4 provide it by default, preferring it to its predecessor easy_install, whose design problems could not be fixed without breaking compatibility. The mechanism is the ensurepip module: each maintenance and feature release of CPython bundles the latest stable pip as a private copy, and ensurepip installs that copy into an installation or a new virtual environment without accessing the internet. The PEP is explicit that pip stays external to CPython, maintained by the Python Packaging Authority (PyPA). Two things follow. The pip in an environment is as old as the Python that created the environment, and python -m pip install --upgrade pip is the normal way to refresh it. And a pip problem can force a Python release: 3.13.17, of 21 October 2026, was a special security release whose purpose was to raise the embedded pip to 26.2.2, because that pip carries a newer copy of the certifi root-certificate bundle, after a certificate authority incident.
Versions follow the calendar. A version number has the form YY.N, where the first number is the year and the second identifies the quarter, with releases planned for January, April, July and October and a deprecation period of at least six months for documented behaviour. Version 1.0 dates from 4 April 2011; support for Python 2 ended with pip 21.0; pip 26.1 dropped Python 3.9; and the changelog read on 12 November 2026 ends at 26.3, released on 2 November 2026.
An install is a search, a resolution and an unpacking. pip looks for candidates on PyPI, or on the index given with --index-url (the default is https://pypi.org/simple), in local directories, and in any location added with --find-links or --extra-index-url; there is no priority among these places, and the best match by version wins. It then resolves dependencies, which it can only learn by downloading distribution files; since version 20.3 the resolver backtracks when an earlier choice turns out to be incompatible, which is why a long install sometimes shows several versions of the same package being fetched. A wheel is unpacked into site-packages; a source distribution is first built into a wheel by the project's build system, on the installing machine. Two caches, on by default since 6.0, shorten the next run: one for HTTP (Hypertext Transfer Protocol) responses, which behaves like a browser cache, and one for wheels built locally. Everything lands in the environment of the interpreter that runs pip, which is why the user guide spells the command as python -m pip (py -m pip on Windows): the interpreter named is the one that receives the packages.
The command set is small. install, uninstall, list, show, freeze, check and inspect manage and describe an environment; download, wheel and hash handle distribution files; index and search query an index; cache, config and debug concern pip itself; lock, still experimental, writes the standard pylock.toml lock file. A requirements file passed with -r lists what to install, and a constraints file passed with -c only limits versions: naming a package there does not install it, which makes one constraints file usable across an organization. pip freeze prints the environment in requirements format, but PyPI's own incident guidance points out that this is not a lock file, because a lock must carry the hashes of the archives.
Behaviour can be set in three places: on the command line, in environment variables (each option has one, formed with the PIP_ prefix) and in configuration files in INI format at three levels, global (/etc/pip.conf), per user (pip.conf under .config/pip in the home directory) and per environment (pip.conf at the root of the virtual environment), named pip.ini on Windows. The network options are the ones an operations team ends up reading. --proxy takes a proxy URL (Uniform Resource Locator) with optional credentials; --timeout defaults to 15 seconds and --retries to 5. pip has verified HTTPS certificates by default since version 1.3. --cert, or PIP_CERT, points it at a bundle of certificate authority certificates, and since 24.2 pip also trusts the operating system's certificate store, in addition to its bundled certifi list, through the truststore library. That change is what lets pip work behind a proxy that inspects TLS (Transport Layer Security) and re-signs traffic with a private authority the machine already trusts; before it, the authority had to be passed to pip explicitly. --trusted-host does the opposite of all this, accepting a host without valid HTTPS, and belongs in no permanent configuration.
The security defaults are stated without comfort in pip's documentation: by default pip does not perform any checks to protect against remote tampering, and installing involves running arbitrary code from distributions. Hash-checking mode, available since 8.0, answers the first half. A requirement line carries one or more --hash values, and once any line has one the mode is on for all: every requirement and every dependency must be pinned with == and hashed, sha256 being the recommended algorithm, while md5, sha1 and sha224 are refused. The hash an index puts in a download URL does not count, since it comes from the same remote source and only detects a corrupted download. --only-binary :all: answers the second half by refusing source distributions, so that no build code runs, although the 26.3 changelog adds that pip has never considered installing untrusted wheels safe, because Python's import system is dynamic (release 25.0 had fixed a bug that let a crafted wheel execute code during installation). Two more options address the index. pip's documentation calls --extra-index-url unsafe for private packages, the dependency confusion case, and --uploaded-prior-to, added in 26.0 and accepting durations such as P3D since 26.1, ignores releases newer than a given age on indexes that publish upload times.
pip also refuses on purpose. Since 23.0 it reads the EXTERNALLY-MANAGED marker that PEP 668 lets a Linux distribution place in its Python, and outside a virtual environment it stops with an error unless --break-system-packages is given (added in 23.0.1); --require-virtualenv makes the same refusal a local policy. Its neighbours cover what it leaves out: pipx installs command-line applications, each in its own virtual environment, where pip installs into whatever environment is active with no isolation; uv, which like PDM and Poetry also uses PyPI by default, requires a virtual environment unless told otherwise. And pip reports little about its user: it collects no telemetry, but each request tells the index the Python version and operating system in use.
Also known as: python -m pip, pip install
Sources
- pip documentation, home page (read 2026-11-12): pip is the package installer for Python, used to install packages from the Python Package Index and other indexes; it collects no telemetry but sends non-identifying environment information (Python version, OS) to the indexes used
- pip documentation, Secure installs (read 2026-11-12): by default no checks against remote tampering, and arbitrary code from distributions is run; hash-checking mode (since 8.0), all-or-nothing, with pinned and hashed dependencies; sha256 recommended, md5, sha1 and sha224 excluded; the hash in an index URL guards only against download corruption; --only-binary :all:
- python.org, Python 3.13.17 release page, release date 21 October 2026 (read 2026-11-12): embedded pip upgraded to 26.2.2 to upgrade its copy of certifi to 2026.10.19 for the eMudhra / emSign CA certificate incident; pip is not normally updated in security releases; upgrade pip and uv in all existing virtual environments
- Ian Bicking, pyinstall is dead, long live pip!, 28 October 2008 (read 2026-11-12): pyinstall renamed to pip; the name is an acronym and a declaration, pip installs packages
- Donald Stufft and Alyssa Coghlan, PEP 453, Explicit bootstrapping of pip in Python installations, created 10 August 2013, Final (read 2026-11-12): pip recommended as the default installer and provided by default from Python 3.4; chosen over its predecessor easy_install; a private copy bundled with CPython that does not contact PyPI; pip remains external to CPython, maintained by the Python Packaging Authority
- Python documentation (3.15.2), ensurepip, Bootstrapping the pip installer (read 2026-11-12): added in 3.4; pip is an independent project with its own release cycle, the latest stable version is bundled with CPython maintenance and feature releases; the module does not access the internet; python -m ensurepip --upgrade
- pip documentation, Release process (read 2026-11-12): a release every 3 months, in January, April, July and October; version numbers YY.N; deprecations announced for at least 6 months
- pip documentation, Changelog (read 2026-11-12): 1.0 on 2011-04-04; Python 2 support removed in 21.0; 23.0 (2023-01-30) reads EXTERNALLY-MANAGED and 23.0.1 (2023-02-17) adds --break-system-packages; 25.0 fixes a wheel that could execute code during installation; 26.0 (2026-01-30) adds --uploaded-prior-to; 26.1 (2026-04-26) accepts durations, reads pylock.toml experimentally and drops Python 3.9; 26.2.2 (2026-10-20) upgrades certifi; 26.3 (2026-11-02) states that installing untrusted wheels was never considered safe
- pip documentation, User Guide (read 2026-11-12): python -m pip executes pip using the interpreter you specified as python, py -m pip on Windows; requirements files; constraints files control which version is installed, not whether it is installed
- pip documentation, pip install (read 2026-11-12): pip looks on PyPI or the --index-url (default https://pypi.org/simple), in the local filesystem, in --find-links and --extra-index-url locations, with no priority among them; --extra-index-url for private packages is unsafe (dependency confusion); --require-hashes, --only-binary, --uploaded-prior-to
- pip documentation, pip command reference, general options (read 2026-11-12): --proxy, --timeout (default 15 seconds), --retries (default 5), --cert (a PEM-encoded CA bundle), --trusted-host, --require-virtualenv, each with its PIP_ environment variable
- pip documentation, Commands (read 2026-11-12): install, uninstall, inspect, list, show, freeze, check, lock, download, wheel, hash, search, index, cache, config, debug
- pip documentation, pip lock (read 2026-11-12): EXPERIMENTAL; locks packages and their dependencies into a lock file valid for the current Python version and platform
- pip documentation, Dependency Resolution (read 2026-11-12): pip downloads distribution files to learn dependencies; since 20.3 the resolver backtracks, which can look like downloading several versions of one package; --no-deps
- pip documentation, Caching (read 2026-11-12): on by default since 6.0; an HTTP cache that works like a web browser's and a cache of locally built wheels
- pip documentation, Configuration (read 2026-11-12): command-line options, environment variables and INI configuration files at global, user and site level (/etc/pip.conf, $HOME/.config/pip/pip.conf, $VIRTUAL_ENV/pip.conf; pip.ini on Windows); PIP_CONFIG_FILE
- pip documentation, HTTPS Certificates (read 2026-11-12): certificate verification by default since 1.3; --cert, PIP_CERT, REQUESTS_CA_BUNDLE, CURL_CA_BUNDLE; since 24.2 system certificates are used in addition to certifi through truststore (opt-in from 22.2); --use-deprecated=legacy-certs
- pip documentation, Repeatable Installs (read 2026-11-12): pinning with == trusts the index and the certificate authority chain; hashes protect against a compromise of PyPI or of the HTTPS certificate chain; a wheelhouse built with pip wheel installs without an index
- Geoffrey Thomas and others, PEP 668, Marking Python base environments as "externally managed", created 18 May 2021, Final (read 2026-11-12): an installer outside a virtual environment that finds the EXTERNALLY-MANAGED marker should exit with an error; the override --break-system-packages
- PyPI blog, Incident Report: LiteLLM/Telnyx supply-chain attacks, with guidance, 2 April 2026 (read 2026-11-12): dependency cooldowns with --uploaded-prior-to; pip freeze does not create a lock file, which must include hashes; pip lock is experimental support for pylock.toml
- pipx documentation, home page (read 2026-11-12): pip installs both libraries and applications into whatever environment is active, with no isolation; pipx installs only applications, each in its own virtual environment, using uv when available and pip otherwise
- uv documentation (Astral), Using Python environments (read 2026-11-12): unlike pip, uv requires using a virtual environment by default
- PyPI documentation, PyPI Basics (read 2026-11-12): the standard package manager included with Python is pip; PDM, Poetry and uv also use PyPI as their default source