python auth_error ai_generated true

错误:这些包与需求文件中的哈希值不匹配。如果你更新了包版本,请更新哈希值。否则,请仔细检查包内容;可能有人篡改了它们。

ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them.

ID: python/pip-hash-mismatch-download

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

版本兼容性

版本状态引入弃用备注
3.8 active — — —
3.9 active — — —
3.10 active — — —
3.11 active — — —
3.12 active — — —

根因分析

带有 --hash=sha256:... 的 requirements 文件固定了特定产物的哈希值。下载的 wheel/sdist 哈希不同,通常是因为版本更新后未重新生成哈希,或者解析到了不同的平台 wheel。

English

A requirements file with --hash=sha256:... pins a specific artifact hash. The downloaded wheel/sdist has a different hash, usually because the version was updated without regenerating hashes, or a different platform wheel was resolved.

generic

解决方案

  1. 95% 成功率
    pip install pip-tools && pip-compile --generate-hashes requirements.in
  2. 88% 成功率
    Add another --hash=sha256:<newhash> line to the package entry
  3. 80% 成功率
    pip download --only-binary=:all: --platform manylinux2014_x86_64 --python-version 311 package && pip hash *.whl

无效尝试

常见但无效的做法:

  1. 85% 失败

    Hash checking still applies to the directly requested package.

  2. 30% 失败

    Disables supply-chain protection entirely; defeats the purpose of the pin.