ERROR pip data_error ai_generated true

ERROR: Could not install packages due to a ZipError: [Errno 2] No such file or directory: '/path/to/package.whl'

ID: pip/zip-deflate-error

Also available as: JSON · Markdown · 中文
85%Fix Rate
82%Confidence
1Evidence
2023-09-20First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
pip 23.1 active
pip 24.0 active
Python 3.10 active
Python 3.11 active

Root Cause

pip encounters a corrupted or incomplete .whl file during installation, often caused by interrupted download or filesystem issues like a full disk or bad sectors.

generic

中文

pip 在安装过程中遇到损坏或不完整的 .whl 文件,通常由下载中断或文件系统问题(如磁盘满或坏扇区)引起。

Official Documentation

https://pip.pypa.io/en/stable/topics/local-project-installs/

Workarounds

  1. 90% success Clear pip's cache and re-download: pip cache purge && pip install package --no-cache-dir
    Clear pip's cache and re-download: pip cache purge && pip install package --no-cache-dir
  2. 88% success Manually delete the specific .whl file from pip's cache directory: rm -rf ~/.cache/pip/http/* && pip install package
    Manually delete the specific .whl file from pip's cache directory: rm -rf ~/.cache/pip/http/* && pip install package
  3. 95% success If the disk is full, free up space: df -h . && rm -rf /tmp/pip-* && pip install package
    If the disk is full, free up space: df -h . && rm -rf /tmp/pip-* && pip install package

中文步骤

  1. Clear pip's cache and re-download: pip cache purge && pip install package --no-cache-dir
  2. Manually delete the specific .whl file from pip's cache directory: rm -rf ~/.cache/pip/http/* && pip install package
  3. If the disk is full, free up space: df -h . && rm -rf /tmp/pip-* && pip install package

Dead Ends

Common approaches that don't work:

  1. 70% fail

    Running pip install --no-cache-dir does not fix the corrupted .whl; it only bypasses the cache but the download may still be corrupt.

  2. 85% fail

    Using pip install --force-reinstall only re-downloads the same corrupted wheel if the source is bad.

  3. 95% fail

    Setting PIP_REQUIRE_VIRTUALENV does not address the file corruption; it's unrelated to disk or download issues.