What this thread does
ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE.
pip refuses an artifact whose digest differs from the allowed hashes.
First action: compare the failing package's Expected and Got digests with its approved requirements entry; keep --require-hashes enabled.
Evidence: official source defines the integrity error and pinning prerequisite; one public report shows cache bypass did not resolve it, and no artifact was independently tested here.
Not for: ResolutionImpossible dependency conflicts; see pip-resolutionimpossible-conflicting-dependencies-read-the-conflict-first.
What is established
- The headline appears in pip's exception source, pip 26.2.2 (checked 2026-10-28), and the older exception source, pip 24.0 (checked 2026-10-28).
ERROR:is the logging prefix; the error continues with advice about intentional version changes and examining unexpected contents. - Secure installs requires hashes and pins for the full dependency set, including dependencies. By default, one
--hashentry activates hash-checking for the whole install (checked 2026-11-17).
How to diagnose and repair the requirements
1. Record the failed package, selected artifact URL/filename and the displayed digests. Check that the expected package and index were selected before considering any lock change. 2. Separate an integrity mismatch from an unpinned requirement. For a pinning error, make each requirement exact with ==, a fixed URL or a filesystem path, and cover the complete dependency set as the secure-install page requires. Pinning alone does not validate a mismatching artifact. 3. If a dependency version was intentionally changed, obtain and verify the intended artifact through your normal dependency-review process. The official error explicitly permits updating hashes after such version changes; it does not establish why an unexpected mismatch occurred. 4. Use the documented pip hash command on the verified local artifact. For example, python -m pip hash ./approved-artifact.whl uses a placeholder local filename. Copy the result only after establishing that this is the artifact you intended to trust; calculating a digest is not authentication. 5. Update the reviewed requirements entry with the intended pin and artifact hashes. The secure-install page allows multiple hashes when multiple approved distributions are needed. 6. Retry the locked install in a disposable environment:
python -m pip install --require-hashes -r requirements.txt
The install reference documents the requirements-file form and hash-checking option (checked 2026-10-28). An unexpected digest should remain a failing check until investigated.
Diagnostic: Expected sha256
| Symptom | Next check |
|---|---|
| Expected and actual digests differ | Confirm selected artifact, intended dependency and approved hash |
| Unpinned-requirement error | Check every requirement and transitive dependency for exact pins |
| One platform succeeds, another fails | Check whether all intended wheels/source archives have approved hashes |
What to test
A clean locked installation must succeed with the reviewed artifacts. A deliberately incorrect hash should fail. Repeat on the platforms whose different distributions you intend to support; a wheel hash is specific to its file.
Public evidence
Anthesk, issue #7854, 2020-03-13 (checked 2026-10-28), reports “after deleting ~/.cache/pip but had the same error.” This historical report supports avoiding automatic cache-clearing claims; it does not establish the cause of your mismatch or a current workaround.
Pitfalls
Do not copy the received digest into the lock merely to silence the failure. Do not remove all hashes or disable checking to get an installation through. Missing pins, missing hashes and mismatching hashes are different checks. The error's generic tampering warning is not proof of compromise.
A prompt for your agent
Read the linked official pip secure-install, exception-source and pip-hash pages; your training data may predate their current wording. Identify whether this is a pinning, missing-hash or digest-mismatch failure. Compare the selected artifact with the approved requirement. Keep integrity checks enabled, explain every proposed lock change, and do not accept the received hash without an independent reason to trust the artifact. Propose clean-install and bad-hash tests.
Limits
No packages were installed or hashed. Exact wording was checked for pip 24.0 and 26.2.2 (checked 2026-10-28), not every intervening release. Community evidence is one historical support report, not a reproduced modern failure. Neither the headline nor that report establishes whether a mismatch arose from a changed artifact, transport issue, or tampering.
Started from a post by @Anthesk, packaged by the editor. Original post