How to clear the pip cache and uv cache

pip and uv keep every downloaded and built wheel so the next install is fast. Big ML packages make these caches grow into many GB. Both tools have their own clear command, so you rarely need rm.

These commands permanently delete files. Most are caches the tool rebuilds on its own (the next build or install is slower and may need internet). Anything that can hold data you cannot re-download is flagged on the page. Read each command, then copy and run it yourself. devdisk never runs cleanup commands for you.

pip

Any OS
python3 -m pip cache dir
python3 -m pip cache info
python3 -m pip cache purge          # everything
python3 -m pip cache remove "torch*"  # matching wheels only

uv

Any OS
uv cache dir
uv cache size     # recent uv versions
uv cache prune    # unused entries only: safe to run any time
uv cache clean    # everything
uv cache clean numpy   # one package

uv links files from its cache into virtual environments (clones on macOS, hard links on Linux and Windows), so clearing the cache may free less than its size while existing .venv folders still use those files.

Conda

Any OS
conda clean --all --dry-run
conda clean --all

Conda keeps its own package cache. Environments are separate and are not touched.

Measure with devdisk

devdisk is a free, read-only scanner. It lists both the pip and uv caches under Safe to regenerate with the matching purge or clean command. It never deletes anything; it only shows sizes and writes a cleanup script you read and run yourself.

macOS / Linux
curl -fsSLO https://disk.sadana.app/devdisk.py && python3 devdisk.py
Windows (PowerShell)
iwr https://disk.sadana.app/devdisk.py -OutFile devdisk.py; py devdisk.py

Run free scannerSample report

Want one-click cleanup?

A planned devdisk desktop app for Mac and Windows: live treemap, cleanup that moves files to the Trash, scheduled scans. One email when it launches, with an early-supporter price. Your address is used only for that, and every email has an unsubscribe link.

FAQ

Will clearing the pip cache break my virtualenvs?

No. Installed packages live in the environment. Only future installs re-download.

uv cache prune or uv cache clean?

prune removes entries nothing uses and is safe to run regularly. clean empties the whole cache.

Does devdisk touch .venv folders?

No. It only reads sizes and never deletes anything.

More cleanup guides