Poetry doesn't respect version specifiers in Requires-Dist for dependencies
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: Windows 10 2004
- Poetry version: 1.0.10
- Link of a Gist with the contents of your pyproject.toml file: https://gist.github.com/f0ff886f/3178ffdf080e67a5fdfa3fcbd5503d31
Issue
poetry add rich@latest
...
[SolverProblemError]
The current project's Python requirement (^3.6) is not compatible with some of the required packages
Python requirement:
- dataclasses requires Python >=3.6, <3.7
Because no versions of rich match >7.0.0,<8.0.0
and rich (7.0.0) depends on dataclasses (>=0.7,<0.8), rich (>=7.0.0,<8.0.0) requires dataclasses (>=
0.7,<0.8).
Because dataclasses (0.7) requires Python >=3.6, <3.7
and no versions of dataclasses match >0.7,<0.8, dataclasses is forbidden.
Thus, rich is forbidden.
This is related to but doesn’t seem to be directly addressed by the many “Python requirement (^3.6) is not compatible with some of the required packages” issues. Closest issue is https://github.com/python-poetry/poetry/issues/2840 and the solution https://github.com/python-poetry/poetry/issues/1930#issuecomment-653906544 doesn’t apply here.
My library is expressing it is compatible with Python ^3.6, which I understand as >=3.6.0, < 4.0.0.
It requires the https://github.com/willmcgugan/rich library which is compatible also with Python ^3.6. The issues starts with Rich’s dependency on dataclasses which started to throw a wrench in many people’s plans it seems by declaring its Python requirement as >=3.6, <3.7
(^3.7 has dataclasses built in).
Now Rich declares its dependency like so:
Requires-Dist: dataclasses (>=0.7,<0.8); python_version >= "3.6" and python_version < "3.7"
When dataclasses is added as a dependency with python_version ~3.6
directly to this project, it resolves dataclasses just fine (which I understand is just shorthand for >=3.6, <3.7
).
But now, when Rich tries to do the same, and I depend on Rich, everything breaks and cannot continue.
The posted solution says to use python_version specifiers, but I cannot do that for Rich, but Rich itself does that and Poetry seems to ignore it.
The workaround is to manually specify rich = "^7.0.0"
in the [tool.poetry.dependencies]
and then something like poetry update
works just fine.
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (2 by maintainers)
Hello, thank you for the work in 1.1.0rc1! I can confirm this bug is gone and I have a fully working and perfectly working Poetry!
@abn downgrading to
1.1.0b2
solved the dependency resolution! BUT… now I hit the exact same problem as in https://github.com/python-poetry/poetry/issues/2911 so that also does not work (every installation of a dependency fails).So
1.1.0b3
doesn’t respect the dependency’spython_version
, and1.1.0b2
causes errors on every dependency installation.I’ll just wait for 1.1.0b5… 👍 I really appreciate the help.