pythonpip

pip: These packages do not match the hashes from the requirements file


When I tried to install libraries using pip install, sometimes this error message come up.

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.

This error comes up when I am trying to build multiple images using docker-compose V2.

What I have done:

  1. pip install --no-cache-dir -r requirements.txt
  2. upgrading pip
  3. trying the old version of pip (20.0.2).
  4. change the version of the affected package.
  5. changing the dns

However, it still comes up randomly. The libraries that are referred to the error message also keep changing.

Does anyone know the reason for this issue?


Solution

  • So I had the same issue, tried deleting the pip cache file and using the "--no-cache-dir" argument. None of those worked.

    I then came across a post that said they were experiencing this error because of a networking issue. So I switched off my VPN and everything worked perfectly!

    Not sure why this works, but it got the job done