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

其他格式: JSON · Markdown 中文 · English
80%修复率
83%置信度
0证据数
2024-09-04首次发现

版本兼容性

版本状态引入弃用备注
3.8+ active — — —

根因分析

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

English

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

解决方案

  1. 92% 成功率
    pip cache purge
    pip install --no-cache-dir -r requirements.txt
  2. 85% 成功率
    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

无效尝试

常见但无效的做法:

  1. 85% 失败

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

  2. 90% 失败

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