python data_error ai_generated true

WARNING: Cache entry deserialization failed, entry ignored ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE.

ID: python/pip-cache-http-error-304-loop

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

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.8+ active — — —

Root Cause

pip's HTTP cache holds a corrupted or stale artifact whose hash no longer matches the pinned --hash in requirements. Often after a partial download or index change.

generic

中文

pip 的 HTTP 缓存持有一个损坏或过期的构件,其哈希不再匹配 requirements 中固定的 --hash。常见于下载中断或索引变更后。

Workarounds

  1. 92% success
    pip cache purge
    pip install --no-cache-dir -r requirements.txt
  2. 85% success
    pip download --no-deps --require-hashes -r requirements.txt -d /tmp/dl
    pip hash /tmp/dl/foo-1.2.3-py3-none-any.whl  # update requirements

Dead Ends

Common approaches that don't work:

  1. 85% fail

    Disables supply-chain integrity checking entirely, defeating the purpose and exposing you to tampered packages.

  2. 90% fail

    You no longer know the artifact is authentic; you've just accepted whatever was downloaded.