Skip to content
Latchkey

pip freeze: Pin the Environment Command Reference

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 or to diff against a lock.

Common flags / usage

  • pip freeze -- print all installed packages as name==version
  • --exclude-editable -- skip -e editable installs (not portable)
  • -l, --local -- exclude globally installed packages in a venv
  • > requirements.txt -- redirect the snapshot to a file

Example

shell
- run: pip install -r requirements.txt
# Assert the resolved set matches the committed lock:
- run: |
    pip freeze --exclude-editable | sort > /tmp/frozen.txt
    diff <(sort requirements.lock) /tmp/frozen.txt

In CI

pip freeze emits "-e <path>" for editable installs and local checkout URLs for VCS installs, which are not portable to other runners. Use --exclude-editable when generating a lock other machines will consume.

Key takeaways

  • pip freeze prints installed packages as exact name==version pins.
  • Use --exclude-editable to keep the output portable across runners.
  • Diff a fresh freeze against a committed lock to catch dependency drift.

Related guides

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