-
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
Poetry v1.1.6 does not respect markers or version specifiers when generating lockfile #3959
Comments
Local testing shows that the marker was preserved at least as recently as
It's possible this never really worked but it at least picked the version on your system that you created a venv for in
|
Not 100% sure if this is the same issue or if I should open a separate one... but I'm seeing something very similar since I moved my env from 3.6.8 to 3.8.5. In my case this manifests itself with the "typing-extensions" package which is a dependency of various packages I use. For most of them the dependency is declared as
However,
which results in `typing-extensions' not being installed on Python 3.8.5... resulting in
when installing (via Update: looking at the dependencies from yarl, there's no "marker"... Who/What/When creates those?
|
I've got a fork that's solving some of the issue re: missing markers; master...tgolsson:ts/markers-in-lockfile. However, while doing the final cleanup and fixing the last tests I noticed that this was part of an intentional change by @sdispater two years ago, #2361. While I understand the motivations of that PR and (some of) what it solves, it leads to forgetting about "top-level" dependencies with markers in the actual pyproject.toml. My PR adds those back and then makes the version solver deal with them again (likely in a far too simplistic manner in light of the original PR). However, the lockfiles that are currently generated without my changes are broken if I'm using markers to toggle versions in my pyproject.toml: torch = [
{ version = "1.10.2+cu111", markers = "sys_platform != 'darwin'" },
{ version = "1.10.2+cpu", markers = "sys_platform == 'darwin'" }
] Without the proper information in the lockfile both One alternative solution route would be to generate the project itself into the lockfile, so if our project is I realize a lot of time has passed @sdispater, but do you remember enough to have any input on solutions here? (Edit: I think that the issue @rschmied posted above is different from markers for primary dependencies, and my fix would have no effect. That seems like a bug in the constraint solving itself.) |
OK; so more investigation and... On latest poetry it seems like if I ensure that there's no overlap anywhere in my versions; it works out fine. I was getting tricked by my fixes because I'd started with one case and then started changing Poetry to fix what was likely an error in my pyproject.toml, and then I eventually fixed that along the way but kept digging. So - I started with the following: torch = [
{ version = "1.10.2+cu111", source="foo", markers = "sys_platform != 'darwin'" },
{ version = "1.10.2", markers = "sys_platform == 'darwin'" }
] And this indeed exhibits some bad behavior, at least when toggling which version belongs on which platform. In particular, 1.10.2+cu111 is a valid subversion for 1.10.2, so there's no fundamental difference between a naked 1.10.2 and the cu111. So, that's what I tried to solve. Later on after doing more experiments I'd unwittingly switched to the I thus think this issue is aimed at solving the wrong problem -- the markers not being in poetry.lock isn't the source of this problem because they are seemingly read from pyproject.toml. I think there's good reasons to have them in poetry.lock for other reasons, but my testing over the last two days conclude that it's not required for Now, one important difference between this and OP's post is that I'm using 1.2.0b1 to test, and the issue was reported for 1.1.6. However, there's clearly bugs with version resolution still -- for example, if I test torch = [
{ version = "1.10.2+cu111", source="foo", markers = "sys_platform != 'linux'" },
{ version = "1.10.2", source="bar", markers = "sys_platform == 'linux'" }
] It'll helpfully offer only Anyways, long story short: I went into a rabbit hole hunting a one year old bug, did a lot of work that was unnecessary, and finally undid everything. As redemption I tested your zipfile @tigerhawkvok and with fresh installed poetry==1.2.0b1 and Python 3.8, I get
Which seems to be what I should expect. |
#5715, probably |
I'm having similar issues with environment markers for torch dependencies being ignored when generating Leading me to this unpleasant (hopefully very temporary!) solution: https://gist.github.com/john-sandall/05f03d6e39978c1aef29e00dd61e253a |
Duplicate #2765 for the original issue -- the people chiming in in the comments have a different issue that should be fixed |
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. |
-vvv
option).Issue
This worked on my prior Poetry build (possibly as old as
v0.12
, but I updated today tov1.1.6
). Neither thepython
nor themarkers
key seems to be respected inpyproject.toml
.An illustrative screenshot:
Full sample:
poetry_dep_bug.zip
If I manually edit my lockfile, I can recover the expected behaviour
The text was updated successfully, but these errors were encountered: