Skip to content
Latchkey

What Is pip? The Python Package Installer Explained

pip is the standard package installer for Python: it downloads and installs libraries from the Python Package Index into your environment.

pip is the tool Python developers use to install packages. It ships with modern Python, talks to the Python Package Index (PyPI), and resolves and installs the dependencies a project needs. Almost every Python CI pipeline runs pip at least once.

What pip is

pip is a command-line installer for Python packages. It fetches packages from PyPI (or a configured index), installs them into the active environment, and can read a list of requirements from a file. It handles wheels (prebuilt binaries) and source distributions.

How it works

You declare dependencies in a requirements.txt or pyproject.toml. Running "pip install" resolves versions, downloads wheels where available, and installs them site-packages. For reproducibility, teams pin exact versions and often generate a fully locked requirements file with hashes. pip installs into whatever environment is active, so it is almost always paired with a virtual environment.

A requirements example

A pinned requirements file plus the install command is the common pattern.

requirements.txt with pinned versions
# requirements.txt
requests==2.31.0
pytest==8.0.0

# install exactly those versions
pip install -r requirements.txt

Role in CI/CD

In pipelines, pip restores dependencies before tests run. Pinning versions (ideally with hashes via "pip install --require-hashes") makes builds reproducible and guards against supply-chain surprises. Caching the pip download cache or the wheel cache between runs avoids re-downloading and speeds up jobs, particularly when packages compile native extensions.

Alternatives

Poetry and PDM add dependency resolution, lockfiles, and project management on top of the install step. uv is a very fast Rust-based installer and resolver that can replace pip and virtualenv. pip remains the lowest-common-denominator tool that every Python environment understands.

Key takeaways

  • pip installs Python packages from PyPI into the active environment.
  • Pin versions (and ideally hashes) for reproducible, secure CI installs.
  • Pair pip with a virtual environment and cache downloads in CI.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →