-
Notifications
You must be signed in to change notification settings - Fork 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
pip does not reinstall an already installed package from a different direct url requirement #7678
Comments
Does the old |
No, it does not. Note a direct reference without package name does upgrade (unconditionally reinstalls? - I've not checked yet). I think in this case it should first get metadata to find out the name and then behave the same as when the name is provided upfront). I think all 3 cases (without name, #egg and PEP 440 name-in-front) should behave the same wrt reinstalling or not. In editable mode, it always upgrades (which makes sense). |
Completely agree that the three cases should behave the same. I wonder why nobody really noticed the nameless and |
Agreed all 3 should work the same. But given that Note: I understand that the user's intention is clearly different in this case - the explicit specification of name + version strongly suggests that the user wants 20.1 whether or not 20.0 is present. But I'd like to better understand how we would cleanly describe the semantics here - it feels like we're getting dangerously close to wanting pip to just "do what I mean" which is notoriously hard to get right, and even harder to document (people don't always mean the same thing, even when the same command is specified!). |
#536 has an extensive discussion over whether we should force reinstall explicitly specified locations. Apparently I was ambivalent when it was discussed then, as well 🙂 |
Interesting discussion in #536. I'm not sure why it is closed, though. Was it the intent to reinstall always (which is the case today for nameless direct requirements)? |
Yeah, I wasn't sure either. The discussion looks inconclusive to me, and the linked PR that supposedly closed it doesn't seem to cover the same topic. I think the problem is that there wasn't consensus on an agreed intent. Personally, I prefer simpler mental models, so my preference is to say that if you want to upgrade, you should just add |
With PEP 610 |
I seems using The default behaviour of not upgrading is unintuitive in most cases, however. So maybe we can approach this in two steps:
|
Note that the new resolver will affect behaviour here. Currently, requesting an install of a URL or file (named or nameless) will basically do that install (subject to the question here about upgrades). With a real resolver, there's the possibility that installing will cause a conflict, and so will get rejected for that reason. So the user expectation will need to be a little more nuanced that "reinstall always" in any case under the new resolver. I'm not sure if this affects the discussion here, but I wanted to point it out because it's a subtle but important UX difference with the new resolver that will likely need careful managing as part of the resolver rollout. |
@pfmoore my impression (trying to factor out my own use cases) is that the common use case for direct URLs is very similar to pinning a version. For instance when pointing to a VCS tag, a VCS commit id, an archive with a version number in it, or a local directory, the user says "I want this specific version and not any other one". So this could mean direct URL requirements could be handled the same as |
Yes, that's how I'd expect the new resolver to handle it. |
We'd want to check this out. :) |
Hey, is this basically a part of #5780 now? |
I’ll go ahead and close this in favour of #5780. Kindly raise your voice if you feel it is a mistake. |
What's the problem this feature will solve?
Assume
packaging
has been installed withpip install "packaging @ git+https://github.com/pypa/packaging@20.0"
.Then try to install from the 20.1 tag:
pip install "packaging @ git+https://github.com/pypa/packaging@20.1"
. The second install does nothing, saying the requirement is already satisfied.Describe the solution you'd like
The second install should reinstall with the requested requirement.
Alternative Solutions
Additional context
This requires PEP 610 to implement. This may or may not influence the ongoing reflection about the resolver.
The text was updated successfully, but these errors were encountered: