Poetry version solving fails #9469
Replies: 9 comments 1 reply
-
You've requested that your project support all versions 3.x of python. You've also requested pyyaml, which only works for python version 3.6 and greater. As a particular example, you've requested that your package work for python 3.5, but that conflicts with pyaml needing at least 3.6. |
Beta Was this translation helpful? Give feedback.
-
I appreciate the link, it helps explain the situation. I think it's important to point out that this is a counter-intuitive use of dependencies. Specifying dependency ranges indicates which ranges are operable with the package, not what ranges are required. The point of version solving is to determine the usable set of packages (or none, if it cannot be solved). The approach poetry takes here seems to run counter to the rules set forth by python versioning: https://packaging.python.org/en/latest/specifications/version-specifiers/#compatible-release
This is also in line with intuitive expectations, and the way all other package managers I'm aware of specify dependencies. If the |
Beta Was this translation helpful? Give feedback.
-
The difference between these two ideas is lost on me. If a package is published with the metadata as is, someone running python3.5 would get a pip error installing the package, because pyyaml could not be installed. Make the python requirement a subset of the python required of the dependencies. If there's any suggested improvements to the documentation or error message, then please give them. |
Beta Was this translation helpful? Give feedback.
-
That may not have been very well worded, sorry. I'll try to clarify. A version range specification is a shorthand for a set of versions that a package can remain operable with. So, say some The complexity arises when At this point, solving has two options:
In the first case, the range is an indicator of compatibility for code and all of its dependencies. This is counter-intuitive because there exists a set of valid packages that could be used, but the version solver errors without attempting to discover that set. One of the primary benefits of general version ranges is not needing to constantly update versions as various dependencies get updated. This benefit is lost in the case (like here) where In fact, this either leads to the undesirable behavior where Obviously, my primary recommendation would be to alter the version solving algorithm poetry uses. Baring that, perhaps clarifying the requirement in the error message would help? But I think there will always be confusion around this, as it is unexpected behavior.
|
Beta Was this translation helpful? Give feedback.
-
your proposed change to the error message is definitely worse: it is not true that the current project supported python range must "precisely match" the range from requirements. "compatible" per the current wording is correct. possibly what you have not appreciated is that python is not like other requirements. If a user running python 3.3 types anyway this all is working as expected and has been discussed often enough to make it into the FAQ (and if you search you will find a handful of issues too). Feel free to submit a merge request improving the docs or the error message - being careful that what you are proposing is indeed an improvement! - and please close this. |
Beta Was this translation helpful? Give feedback.
-
I'm really trying to understand the reasoning here.
While its true that the installer does not select the compatible python version, if the user is running python 3.6, why error? This is fundamentally what I am missing. It seems like the expected behavior would be to only error if the user is not running a compatible version. But Poetry will error if the python version is not a subset, even if the user is running a version within the range intersection, and is thus compatible. I think this is exacerbated by there apparently being a default value, forcing all projects to override it:
This is the error if no python version is set. So is the official recommendation to manually determine the intersection of all dependencies, and then keep the project's python version in line with that intersection on every update? And if so, why? What benefit is there in doing that? |
Beta Was this translation helpful? Give feedback.
-
I see. The primary previous issue is here: #1413, closed a few months ago for inactivity, with the recommendation to open a new issue for related bugs. The discussion seems to be almost exactly the same as the one I have raised here. I do not see an answer to the questions here on that thread, though the closest I believe is the following comment:
This seems to misunderstand both the meaning of "invalid dependencies" and the general usage of dependency managers and version solvers. Of course, it is the prerogative of the Poetry maintainers to dictate the direction of the project, and I respect that. It may, however, be valuable to the community to have a broader discussion around this topic. The very fact that an FAQ had to be created since this behavior is so commonly misunderstood should probably serve as an indicator that perhaps it should be rethought. If I wanted to open this as a community discussion topic, what would be the appropriate way to do that? |
Beta Was this translation helpful? Give feedback.
-
here and discord are where conversations happen. but this particular conversation has happened enough times that I am confident in recommending that there is little value in trying to have it again. If your project is not installable on (say) python 3.1, poetry takes the view that you should provide a requires-python that excludes (say) python 3.1. |
Beta Was this translation helpful? Give feedback.
-
This is because Poetry solves the dependency graph for a whole range of Python versions, not just the one currently being used. Just the fact that you are at a given point running a version that is compatible with a given |
Beta Was this translation helpful? Give feedback.
-
Description
Trying to version solve with very general requirements:
package-a deps:
package-b was built using setup tools, and does not have a pyproject yaml file.
deps:
Nets the error:
The error message very obviously states the supported version range is >=3,<4, but then fails claiming >=3,<3.6 is outside this range.
This happens for quite a few packages.
Workarounds
None I've discovered so far.
Poetry Installation Method
pipx
Operating System
MacOS
Poetry Version
Poetry (version 1.8.3)
Poetry Configuration
Python Sysconfig
No response
Example pyproject.toml
No response
Poetry Runtime Logs
Beta Was this translation helpful? Give feedback.
All reactions