Glossary

Pip Freeze

pip freeze is a command that outputs every installed package in the current environment, along with its exact version number, in a format suitable for a requirements.txt file. Running pip freeze > requirements.txt captures a snapshot of your environment that can be recreated with pip install -r requirements.txt.

This snapshot approach ensures reproducible environments: anyone (or any CI server) can install exactly the same package versions. Without pinned versions, pip install fetches the latest version, which may introduce incompatibilities or bugs. Pinning every dependency (including transitive dependencies) is the simplest way to guarantee reproducibility.

The main limitation of pip freeze is that it captures everything in the environment, including packages you installed for debugging or experimentation. Tools like pip-tools (pip-compile and pip-sync) provide a more disciplined workflow: you maintain a high-level requirements.in with your direct dependencies, and pip-compile generates a fully pinned requirements.txt with all transitive dependencies. Modern alternatives like Poetry and PDM manage lock files automatically as part of their dependency resolution workflow.

Related terms: pip, Virtual Environment, pyproject.toml

Discussed in:

This site is currently in Beta. Please email Chris Paton (cpaton@gmail.com) with any suggestions, questions or comments.