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.

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).

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:closed
  • Created 3 years ago
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
f0ff886fcommented, Sep 27, 2020

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!

0reactions
f0ff886fcommented, Sep 23, 2020

@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’s python_version, and 1.1.0b2 causes errors on every dependency installation.

I’ll just wait for 1.1.0b5… 👍 I really appreciate the help.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Dependency specification | Documentation | Poetry - Python ...
This chapter will tell you how to make your library installable through Poetry. Versioning Poetry requires PEP 440-compliant versions for all projects.
Read more >
A Poetic Apology. Or Why Should You Use Poetry to Manage…
Proper dependency resolution is the top required feature of any package manager worthy of respect yet pip only implemented that feature by late...
Read more >
6 - Stack Overflow
Poetry is a dependency manager for developing packages, as such it doesn't deal with deployment issues as much and only targets them ...
Read more >
Should You Use Upper Bound Version Constraints?
To be clear, Poetry doesn't force version pinning on you, but it does push you really, really hard to always version cap, and...
Read more >
poeblix - PyPI
Poetry plugin that adds support for building wheel files using the poetry.lock ... poetry will build a package with the dependency Requires-Dist: pandas ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

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