pip
By the Python Packaging Authority
pip is the standard command-line package installer for Python, used to download and install libraries and applications published on the Python Package Index (PyPI) or other package sources. It reads dependency specifications, resolves…
Definition
pip is the standard command-line package installer for Python, used to download and install libraries and applications published on the Python Package Index (PyPI) or other package sources. It reads dependency specifications, resolves compatible versions, and installs packages into a Python environment, making it the most common way Python developers add and manage third-party code across any project, large or small.
Overview
Python ships with a large standard library, but almost every nontrivial project also depends on third-party packages, and pip exists to make finding, downloading, and installing that code straightforward from the command line. It was created to give Python a single, simple installer, unifying what had previously been a more fragmented set of tools and conventions for distributing Python packages, and it has since become bundled with most modern Python distributions. Mechanically, running `pip install package-name` queries PyPI's index for available versions, downloads a distribution, typically a wheel, a pre-built binary-compatible package format, or a source distribution that pip builds locally, and installs it into the active Python environment's site-packages directory. When a project lists dependencies in a `requirements.txt` file or a `pyproject.toml`, pip can resolve and install the entire set at once, applying its dependency resolver to find versions that satisfy every package's constraints simultaneously, a capability added more rigorously in pip's modern resolver versions after earlier versions handled conflicts less strictly. pip differs from Conda, another common Python package manager, mainly in scope and package format: pip installs from PyPI in Python-specific wheel or source formats and generally assumes system-level non-Python dependencies (like compiled C libraries) are already present, whereas Conda manages packages across languages and can install non-Python system dependencies like compiled libraries directly, which is why data science environments needing complex native dependencies often reach for Conda instead of or alongside pip. Compared to Cargo or npm, pip is more narrowly an installer; environment isolation is typically handled separately, through tools like venv or virtualenv, rather than being an integrated part of pip itself. In practice, developers virtually always pair pip with a virtual environment tool to avoid installing packages into a shared system Python and causing version conflicts across projects; `python -m venv` followed by activating the environment and running `pip install -r requirements.txt` is a near-universal Python project setup pattern. Package authors use complementary tools like `build` and `twine` to package and upload their own libraries to PyPI for others to install via pip. The main limitations are ones pip has historically been criticized for and gradually improved: dependency resolution used to be looser and could silently install incompatible combinations before pip's modern resolver, and pip itself does not manage Python interpreter versions or non-Python system dependencies, tasks left to separate tools like pyenv or Conda. For projects with complex, cross-language dependency needs, teams often layer pip inside a broader environment-management tool rather than relying on it alone.
Key Features
- Installs Python packages from the Python Package Index (PyPI)
- Installs from wheel (pre-built) or source distribution package formats
- Resolves dependency version constraints across a requirements list
- Reads dependencies from requirements.txt or pyproject.toml files
- Bundled by default with most modern Python installations
- Supports installing directly from version control or local paths
- Works alongside virtual environment tools to isolate project dependencies