-
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
Inconsistent virtual environment hashing between 1.1 and 1.2 on Windows #6416
Comments
The hashing function should be stable -- is there any chance you might have moved your project on disk? |
Nope, the only major change is a new GPU (from AMD to NVIDIA, that I just happened to swap right before I upgraded Poetry). I don't suppose the GPU is used for generating hashes? |
Nope, it's a simple alphanumeric encoding of sha256 if my memory serves... That's odd, but I'm not sure it's reproducible. Let me double check if someone changed that code. |
The relevant code is at poetry/src/poetry/utils/env.py Lines 1147 to 1154 in 4078082
It looks like what was in theory a correctness fix may result in different slashes on Windows, causing the inconsistent hash (that managed to skip the changelog): 601dc78 / #6110 |
Windows slashes strike again! This is maybe also the cause of another issue I saw along the way. I have a local package called
and thought "sure, fine, I guess they changed the slashes for this version, as long as it only happens once..." |
Poetry doesn't determine if a project is the same or not by path -- I think that's just inconsistent normalization in the printing code. A MR making it uniform would be welcome, but is not a priority I don't think. I would instead suspect the lack of a That being said, I'm not sure what to do about this hashing inconsistency -- if we fix it in a patch release, we'll just confuse people again. Certainly we can add a unit test to make sure this doesn't move in the future -- but as far as actually changing it back (with tests), I'm not sure. |
More likely #4813. It's is a correctness fix and IMO we won't change that back (see the issues it resolved for more information). For the sake of avoiding virtualenv confusion in poetry 1.2, it's accepted that poetry 1.1 and 1.2 will use different virtualenvs on Windows. |
Fair point -- I'm fine with letting this lie then, as long as you feel the current test coverage is sufficient? |
I think so. Both mentioned PRs have tests. It's clear that changes to |
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 might not be a bug, but after updating to a new version yesterday (1.1.15 -> 1.2.0), a new directory was created for my project (called "learning").
I use IntelliJ (IDEA, but same as PyCharm) to manage my environments, and after running some Poetry operation (I don't recall what) I started getting errors like this:
Which was confusing, because it was definitely installed (I could jump to source, see it in the side bar), but the message didn't go away after clicking install.
I think this is because the IDE was using
virtualenvs\learning-8-kP5BBp-py3.10
but Poetry was using the newvirtualenvs\learning-vjcf-xYS-py3.10
(confirmed by runningpoetry env info --path
)If I went to a terminal outside the IDE and ran
poetry show --latest
I got the (undocumented!) little(!)
next to this library.The fix
I went into the IntelliJ project settings and created a new "SDK" pointing at the new environment. Not sure if this is just for me or if all PyCharm users will have to do it. Is creating a new virtualenv the expected behaviour when upgrading Poetry?
The text was updated successfully, but these errors were encountered: