# pip freeze shows your laptop, not your repo

> Pin what you install, not what pip freeze finds.

Source: https://fullbytedeveloper.com/blog/frozen
Published here: 2026-11-19

```bash
pip freeze > requirements.txt
```

Do this in a shared, polluted environment and the file lists packages your project never uses.

## Why

pip freeze outputs every package installed in the current Python environment. If that environment also has another project's dependencies, dev tools like black or ipython, or leftovers from past experiments, they go in too.

## A cleaner path

Keep a pyproject.toml that lists your direct dependencies under `[project] dependencies`. Install with `pip install .`. pip freeze still lists subs, but they are all real sub-dependencies.

## After shipping a bloated file

Compare with pipdeptree (requires install):

```bash
pipdeptree --warn silence
```

Remove packages that are not subs of your imports.

Send this to the teammate whose requirements.txt lists every package on their laptop.

## Sources

1. [pip docs: freeze](https://pip.pypa.io/en/stable/cli/pip_freeze/)
2. [pipdeptree](https://pypi.org/project/pipdeptree/)
3. [pip docs: requirements file format](https://pip.pypa.io/en/stable/reference/requirements-file-format/)
