pip cache: Manage the Wheel Cache Command Reference
Inspect, locate, or wipe pip download/wheel cache.
pip cache inspects and manages pip local cache of wheels and HTTP responses. CI uses "pip cache dir" to key a cache action and "pip cache purge" to reclaim disk.
Common flags / usage
- pip cache dir -- print the cache directory path
- pip cache info -- show cache size and location
- pip cache list -- list cached wheels
- pip cache remove PATTERN -- remove matching cached wheels
- pip cache purge -- delete the entire cache
Example
shell
- id: pipcache
run: echo "dir=$(pip cache dir)" >> "${GITHUB_OUTPUT}"
- uses: actions/cache@v4
with:
path: ${{ steps.pipcache.outputs.dir }}
key: pip-${{ hashFiles('requirements*.txt') }}
- run: pip install -r requirements.txtIn CI
On a reused runner that fails with "No space left on device" mid-install, "pip cache purge" reclaims disk. For caching across runs, key actions/cache on a hash of your requirements files so it invalidates on dependency changes.
Key takeaways
- pip cache dir prints the path you feed to a cache action.
- pip cache purge clears all cached wheels to reclaim runner disk.
- Key the cache on hashed requirements files so it busts on changes.
Related guides
pip install -r requirements.txt: Command ReferenceReference for pip install -r requirements.txt in CI: installing a whole dependency file, hashed installs, con…
pip download: Fetch Distributions Command ReferenceReference for pip download in CI: fetching wheels and sdists into a directory for offline or air-gapped insta…
pip install: Command Reference for CIReference for pip install in CI pipelines: installing packages, pinning versions, common flags, a GitHub Acti…