Skip to content
Latchkey

pip freeze: Pin Your Environment for CI

Snapshot the exact versions installed right now.

pip freeze outputs installed packages in requirements format with exact versions. Redirect it to a file to capture a reproducible dependency set.

What it does

Prints every installed package as name==version. Editable installs appear as "-e" lines and VCS installs as their source URLs, which matters when you reuse the output.

Common usage

Terminal
pip freeze
pip freeze > requirements.txt
pip freeze --exclude-editable > requirements.txt

Common CI gotcha: editable lines

pip freeze emits "-e <path>" for editable installs and the local checkout for VCS installs, which are not portable to another machine. Exclude them when generating a lock for other runners.

Terminal
# Non-portable line in output:
# -e git+https://...#egg=mypkg

# Fix:
pip freeze --exclude-editable > requirements.txt

Options

OptionDoes
--exclude-editableSkip editable installs
-l, --localExclude globally-installed packages
-r, --requirement FILEOrder output to match a file

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →