Poetry exports incorrect requirements for transitive dependencies, breaks installation with hashes
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).
- OS version and name: Ubuntu 20.04, CPython 3.8.5
- Poetry version: 1.1.11
- Link of a Gist with the contents of your pyproject.toml file: https://gist.github.com/mathrick/ad6b1be5be5e124b3ce1bddbeef24bac
Issue
This seems related to #3363, but I don’t believe it’s a duplicate, and I haven’t seen this mentioned elsewhere.
When exporting requirements.txt
, poetry will add incorrect implementation markers to the output, which in some cases can result in invalid requirement files when used with hashes:
Collecting cffi>=1.0.0
ERROR: In --require-hashes mode, all requirements must have their versions pinned with ==. These do not:
cffi>=1.0.0 from https://devpi.cerebras.aws/root/pypi/%2Bf/57e/9ac9ccc3101fa/cffi-1.15.0-cp38-cp38-manylinux_2_12_x86_64.manylinux2010_x86_64.whl#sha256=57e9ac9ccc3101fac9d6014fba037473e4358ef4e89f8e181f8951a2c0162024 (from argon2-cffi==21.1.0->-r /tmp/reqs.txt (line 16))
This happens because in the generated requirements.txt
, the section for cffi
is as follows:
cffi==1.15.0; implementation_name == "pypy" and python_version >= "3.6" \
--hash=sha256:c2502a1a03b6312837279c8c1bd3ebedf6c12c4228ddbad40912d671ccc8a962 \
--hash=sha256:23cfe892bd5dd8941608f93348c0737e369e51c100d03718f108bf1add7bd6d0 \
[...]
--hash=sha256:920f0d66a896c2d99f0adbb391f990a84091179542c205fa53ce5787aff87954
Notice the implementation_name == "pypy"
marker, even though the implementation used is CPython.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:9 (4 by maintainers)
Top Results From Across the Web
History | Poetry - Python dependency management and ...
Fix an issue where a package from the wrong source was installed for a multiple-constraints dependency with different sources (#6747).
Read more >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 >Defining metadata (meta.yaml) - Conda
If you do not, the package hashes may use different values, and your package may not be testable, because the hashes will differ....
Read more >PEP 665: Specifying Installation Requirements for Python ...
A listing of all indirect/transitive dependencies #. Specifying (at least) specific versions of dependencies for reproducible installations.
Read more >Python has a lot of problems that really slow down ...
Python has a horrible dependency management system, from top-to-bottom. ... Unfortunately, you can't pip install poetry because it needs to manage packages, ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Having said which, this example actually exposes https://github.com/python-poetry/poetry/issues/5593, so thanks for that!
anyway both the original issue and the new example are fixed on master, so probably this should be closed