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

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

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.8 active — — —
3.9 active — — —
3.10 active — — —
3.11 active — — —
3.12 active — — —

Root Cause

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

中文

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

Workarounds

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

Dead Ends

Common approaches that don't work:

  1. 85% fail

    Hash checking still applies to the directly requested package.

  2. 30% fail

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