python system_error ai_generated true

ERROR: Could not install packages due to an OSError: [Errno 28] No space left on device

ID: python/pip-no-space-left-on-device

Also available as: JSON · Markdown · 中文
80%Fix Rate
88%Confidence
0Evidence
2024-09-25First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.8 active
3.9 active
3.10 active
3.11 active
3.12 active

Root Cause

The filesystem hosting the pip cache or the target site-packages has run out of space, often after many wheel downloads accumulate in ~/.cache/pip.

generic

中文

承载 pip 缓存或目标 site-packages 的文件系统空间已耗尽,通常是由于 ~/.cache/pip 中积累了大量 wheel 下载。

Workarounds

  1. 95% success
    pip cache purge
    # or manually
    rm -rf ~/.cache/pip
    df -h ~
    pip install somepkg
  2. 90% success
    export PIP_CACHE_DIR=/mnt/bigdisk/pip-cache
    pip install somepkg
    # or persist it
    pip config set global.cache-dir /mnt/bigdisk/pip-cache

Dead Ends

Common approaches that don't work:

  1. 70% fail

    Avoids new cache writes but the target site-packages still needs space and may be on the same full volume.

  2. 90% fail

    Upgrading pip itself needs space and does not free any.