-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dataclasses solver failure with conditional python marker #2386
Comments
I just ran into what I believe is this same bug, and was able to reliably reproduce it from this example. First, a working dependency specification: [tool.poetry.dev-dependencies]
black = {version = "19.10b0", allow-prereleases = true, python = "^3.6"} All operations (lock, install, show, etc) work as expected with the above. When adding "markers", modifying it to the following: [tool.poetry.dev-dependencies]
black = {version = "19.10b0", allow-prereleases = true, python = "^3.6", markers = "platform_python_implementation == 'CPython'"} I get the following error:
|
I think im also effected by the same error:
My Python version is within the set limits, but not accepted by poetry as a matching version. How can this be solved? |
I think I have the same problem with Coverage.py Using python3 (3.6.9)
Updating dependencies
Resolving dependencies... (0.0s)
[SolverProblemError]
The current project's Python requirement (>=3.6) is not compatible with some of the required packages Python requirement:
- coverage requires Python >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4
Because no versions of coverage match >5.1
and coverage (5.1) requires Python >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4, coverage is forbidden.
So, because austin-python depends on coverage (>=5.1), version solving failed. |
I reproduced withi this very simple config: [tool.poetry]
name = "hey"
version = "0.1.0"
description = ""
authors = ["Timothée Mazzucotelli <[email protected]>"]
[tool.poetry.dependencies]
python = "^3.6"
dataclasses = { version = "^0.7", python = "<3.7" }
[tool.poetry.dev-dependencies]
[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
|
I solved my problem by fixing the projects python version removing the ^ |
I think the problem here is that the environment marker is not taken into account when resolving. |
Poetry could print a hint or offer to fix the project requirements with one of the available options that would allow to proceed. |
I have a workaround by including a package that depends on dataclasses.
|
Now without the additional package, just drop the patch version for dataclases.
|
@jcmuddle Try setting your python version to 3.6.1 instead of ^3.6.1 and report .. this also should work. |
The following pyproject.toml does not install dataclasses:
Is this what you meant @kakulukia ?
|
@sdispater Firstly, thank you for the amazing poetry package and the work you and others have put into it. I saw that you released version 1.0.9 which contained the pull request #2526. However, with the latest version, I'm still seeing the same issue of dataclasses not being installed.
The above is the one failing; perhaps I'm doing something wrong here. |
just add dataclasses as you would normally poetry add dataclasses .. this just worked for me using python 3.6.1 |
Here is a more accurate way:
It works and tells poetry exactly what we want: use Python 3.6 only. |
As the original submitter, I can still reproduce this on the latest Poetry (1.0.9), when running For more context, I'm building an application that runs on any Python from >= 3.6.1, and < 4.0.0 that requires the The only way I can get it to work right now is by commenting the My [tool.poetry.dependencies]
python = "^3.6.1"
dataclasses = {version = "0.7", python = "~3.6.1"} The output from running
|
Same problem as @mands
[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 dataclasses (0.7) requires Python >=3.6, <3.7
and no versions of dataclasses match >0.7,<0.8, dataclasses is forbidden.
So, because betterproto depends on dataclasses (^0.7), version solving failed. I can confirm the workaround above works. (Remove dataclasses, add new package, re-add dataclasses) |
Similar issue:
where [tool.poetry.dependencies]
python = ">=3.6.1, <3.9.0" # see tox below too
dataclasses = {version = "^0.6", python = "^3.6.1, <3.7"} So, what's up with Also, there are some PyPi packages that have started to declare minimal python versions of
An example of a 3rd-party lib causing conflict with the minimal python version when the project is trying to use [tool.poetry.dependencies]
python = ">=3.6, <3.9.0" # see tox below too
dataclasses = {version = "^0.6", python = "^3.6.1, <3.7"}
[tool.poetry.dev-dependencies]
pre-commit = "^2.4" But then:
This is impossible. My {some-lib} is allowed to be used in python >= 3.6, < 4.0 and I expect to be able to use dataclasses anytime that python is a 3.6.x version (and since pre-commit is only a dev-dep, it will never be installed when {some-lib} is installed, so dataclasses trumps pre-commit, and if the actual python is 3.6.0 I don't care if pre-commit cannot be installed), so the following solver error is some kind of a bug:
So long as the dataclasses is restricted to a subset of the project python versions (i.e. the project python versions subsume all the versions allowed by dataclasses), it should pass OK. Consider even the extreme case where all of the dataclasses versions are entirely outside the range of versions allowed by the project (i.e. no version intersection), it could still allow the inclusion of the dataclasses dependency and issue a warning that it is never going to be installed anywhere that the project is allowed. Whenever there is any version intersection between the project python versions and the dependency python versions, that means the dependency could be installed and should be allowed to pass without warning or error. Somehow, poetry is using too-tight coupling of project python versions with dependency versions. Something about the sets of allowed dependency intersections needs to be relaxed for the package-spec. The actual package installation rules are another matter entirely, because the range of options are restricted by the actual python version involved at the time of installation. In the case of dataclasses = {version = "*", python = "~3.6.0", optional = true} It might be cool if we could declare IMO, maybe python should be fully backporting dataclasses into all current py3.6 releases, rather than providing this backport as a package. Give py3.6 this little extra battery that should be included. In case it might help, python, dataclasses and pre-commit seem to play OK together using: [tool.poetry.dependencies]
python = "^3.6"
dataclasses = {version = "*", python = "~3.6.0"}
[tool.poetry.dev-dependencies]
pre-commit = "*" This combination of specs was arrived at by a combination of poetry commands and manual edits. When dataclasses version is specified using |
Having a lot of trouble with this. If a dependency itself depends on a restricted version of |
This happens when adding black Unfortunately, I have to install black separately because of this issue :( |
Reproducible in $ [email protected] add --dry-run arrow
Using version ^0.16.0 for arrow
Updating dependencies
Resolving dependencies... (0.0s)
[SolverProblemError]
The current project's Python requirement (^3.6.1) is not compatible with some of the required packages Python requirement:
- dataclasses requires Python >=3.6, <3.7
Because dataclasses (0.7) requires Python >=3.6, <3.7
and no versions of dataclasses match >0.7,<0.8, dataclasses is forbidden.
So, because poetry-demo depends on dataclasses (^0.7), version solving failed. This should be fixed in $ [email protected] add --dry-run arrow
Using version ^0.16.0 for arrow
Updating dependencies
Resolving dependencies... (0.1s)
Package operations: 0 installs, 0 updates, 0 removals, 5 skipped
• Removing dataclasses (0.7): Skipped for the following reason: Not currently installed
• Installing six (1.15.0): Skipped for the following reason: Already installed
• Installing python-dateutil (2.8.1): Skipped for the following reason: Already installed
• Installing arrow (0.16.0): Skipped for the following reason: Already installed
• Installing dacite (1.5.1): Skipped for the following reason: Already installed |
Had this bug with poetry 1.1.0b4. With this https://github.com/robocorp/rpaframework/blob/master/packages/main/pyproject.toml pyproject toml running any
Worked around the problem by manually modifying |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
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 (Fedora 32):
Poetry version:
pyproject.yaml
Issue
Following on from #1413, the solution there seems to suggest user python version markers to specify when to install a conditional dependencty - in my case the dataclasses-backport on python 3.6.*. However this seems to result in a
SolverProblemError
resolving in certain cases even with the python specifier as indicated in mypyproject.yaml
above .Things seem to work fine until I also install the addional library
dacite
(https://github.com/konradhalas/dacite) - which also has a dependency on dataclasses when using python 3.6. Thesetup.py
for it is as follows,Once this library is also installed, adding any other packages to my project results in the aforementioned
SolverProblemError
, e.g.Commenting then uncommenting out either my use of
dataclasses
ordacite
in mypyproject.toml
to add additional libraries works, but it seems that both my projects and dacite's use of dataclasses with a conditional python marker conflict in poetry.The text was updated successfully, but these errors were encountered: