question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Invalid hashes errors on fresh install

See original GitHub issue
  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).
  • Linux 5.15.7_1:
  • Poetry version 1.1.12:
  • Link of a Gist with the contents of your pyproject.toml file:

Issue

Tried installing to a venv with a clean install of poetry. I am using pyenv to maintain python versions so I do:

pyenv local 3.9.7
poetry env use 3.9.7
poetry install 

This leads to the error

  • Installing torch (1.10.0): Failed

  RuntimeError

  Invalid hashes (sha256:d77fc0e3a4a702b06f591d5276778e9ed8fad2176ffcb4d2cb6b46beb374b5d1) for torch (1.10.0) using archive torch-1.10.0-cp39-cp39-manylinux1_x86_64.whl. Expected one of sha256:034df0b20603bfc81325094586647302891b9b20be7e36f152c7dd6af00deac1, sha256:13e1ffab502aa32d6841a018771b47028d02dbbc685c5b79cfd61db5464dae4e, sha256:3c0a942e0df104c80b0eedc30d2a19cdc3d28601bc6e280bf24b2e6255016d3b, sha256:4499055547087d7ef7e8a754f09c2c4f1470297ae3e5490363dba66c75501b21, sha256:56022b0ce94c54e95a2f63fc5a1494feb1fc3d5c7a9b35a62944651d03edef05, sha256:67fc509e207b8e7330f2e76e77800950317d31d035a4d19593db991962afead4, sha2
56:9013002adcb42bac05dcdbf0a03dd9f6bb5d7ab8b9817041c1176a014870786b, sha256:ab0cf330714c8f79a837c04784a7a5658b014cf5a4ca527e7b710155ae519cdf, sha256:aef7afb62e9b174b4e0e5e1e4a42e3bab3b8490a668d666f62f7d4517559fbf2, sha256:b812e8d40d7037748da40bb695bd849e7b2e7faad4cd06df53d2cc4531926fda, sha256:ca2c88fa4376e2648785029ab108e6e7abd784eb6535fc6036004b9254f9f7c1, sha256:d6185827b285780653cdd81d77a09fdca76a5b190d5986d552be2a5c442cfaa4, sha256:d6ef87470b44df9970e84542547d5ba7720bb89616602441df555a39b124e2bc, sha256:d82e68302c9b5c76ed585e04d61be0ca2184f70cb8ffeba8610570609ad5d7c9, sha256:e01ba5946267014abfdb30248bcdbd457aaa20cff749febe7fc191e5ae096af4, sha256:e5822200bf80a1495ad98a2bb41803eeba4a85ce373e35fc65765f7f888f5374, sha256:eea16c01af1980ba709c00e8d5e6c09bedb5b30f9fa2085f6a52a78d7dc4e125, sha256:eea675ec01ec4b4a0655fd2984f166a5ca3b933dae6ad4eb4e52eba7026dc176.

  at ~/.local/share/pypoetry/venv/lib/python3.9/site-packages/poetry/installation/executor.py:627 in _download_link
      623│                     )
      624│                 )
      625│
      626│             if archive_hashes.isdisjoint(hashes):
    → 627│                 raise RuntimeError(
      628│                     "Invalid hashes ({}) for {} using archive {}. Expected one of {}.".format(
      629│                         ", ".join(sorted(archive_hashes)),
      630│                         package,
      631│                         archive_path.name,

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:12
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

10reactions
JeroenDelcourcommented, Dec 14, 2021

I ran into the same issue and fixed it by uninstalling poetry, completely removing Poetry’s cache directory, and reinstalling Poetry:

curl -sSL https://install.python-poetry.org | python3 - --uninstall
# if the above command tells you poetry isn't installed, try this instead (poetry's previous installer has recently been deprecated):
# curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python - --uninstall
rm -r ~/.cache/pypoetry
# if your poetry cache is somewhere else, this tells you where: poetry config --list
curl -sSL https://install.python-poetry.org | python3 -
2reactions
hopper-signifydcommented, Feb 2, 2022

I’m able to consistently reproduce this issue by doing something like this:

  1. Create two projects A and B such that A depends on B.
  2. Remove the poetry cache (and the .venv folders for A and B if those already exist)
  3. Run poetry install on both projects simultaneously.

This produces the “invalid hashes” error mentioned in the original post if one project tries to read a package from the Poetry cache while the other project is in the process of writing it to the Poetry cache.

Setting installer.parallel to false doesn’t do anything here since these poetry processes are running independently of one another. Does anyone have any suggestions on how to work around this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python poetry install failure - invalid hashes - Stack Overflow
There are several issue reports about invalid hashes. One common cause is running multiple Poetry instances simultaneously; ...
Read more >
History | Poetry - Python dependency management and ...
Fix an issue where poetry install fails because of missing hashes for url dependencies (#6389). Fix an issue where Poetry was not able...
Read more >
Event log Audit Failure - invalid hash on acronis\cyberprotect ...
I noticed by chance a security event log entry after a cold boot of my PC, Event 5038: "Code integrity determined that the...
Read more >
Dependency Management With Python Poetry
Install dependencies with poetry.lock; Execute basic Poetry CLI commands. Using Poetry will help you start new projects, maintain existing ones, ...
Read more >
Admin Authentication API Errors | Firebase - Google
The error message should contain the response from the Authentication server ... auth/invalid-hash-algorithm, The hash algorithm must match one of the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found