python install_error ai_generated true

ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. Expected sha256 abc... Got def... /root/.cache/pip/wheels/.../mypkg-1.0-py3-none-any.whl

ID: python/pip-cache-corrupt-wheel-hash

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

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.x active

Root Cause

A cached wheel in ~/.cache/pip is corrupted or was built from different sources, so its hash no longer matches the pinned value.

generic

中文

~/.cache/pip 中的缓存 wheel 已损坏或由不同源码构建,因此其哈希不再与固定值匹配。

Workarounds

  1. 97% success
    pip cache purge
    pip install --no-cache-dir -r requirements.txt
  2. 95% success
    rm -rf ~/.cache/pip/wheels
    pip install -r requirements.txt

Dead Ends

Common approaches that don't work:

  1. 80% fail

    Force reinstall still consults the cache and reuses the corrupted wheel.

  2. 90% fail

    Does not bypass hash verification or cache lookup.

  3. 95% fail

    Only affects TLS trust, not wheel hash verification.