Skip to content
Latchkey

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.txt

In 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

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