-
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
Adopting "working" scheme for every run #4575
Comments
Oh, and this would let you set a default scheme for yourself using the configuration toolchain. |
In principle this sounds like a reasonable thing to do - but I'm afraid I've got some personal priorities at the moment that mean I don't really have time to think through the implications. So count me as in favour in principle, but not really able to provide a detailed review at the moment, sorry. |
Cool. Thanks! :) |
Just noting that I briefly thought that However, I subsequently realised that these uses are actually the same use case - the new |
Linking to #2418 since I somehow always forget there was an attempt at making
This is, actually, nice that the names here and there match. :) |
This came up in #4809 where I suggested being able to |
I've gone ahead and made a PR for this -- #4871. Thoughts @dstufft, @xavfernandez? Maybe Barry Warsaw (his name's on the Debian patch to pip; #1668 would be fixed as a part of that PR) should be pinged for this discussion? |
How does |
I personally think that fallback logic is too complicated. If you're operating under a badly configured distro, use virtualenv. |
@nanonyme The fallback has nothing to do with what you call "badly" configured distro. Here is a very simple use case: you have a bash script that call "pip install foo", which is needed for testing you code. You want to make this script usable regardless if user is inside an virtualenv or not. The script could be called by tox so it would be inside a virtualenv, it may be called by user outside a virtualenv or by user after the activated a virtualenv. All these use cases are not only valid but also wild spread. At this moment it requires adding a lot of extra logic inside that bash script in order to detect virtualenv presence and decide which params to give to pip. I gave the bash script just as an example but in practice users may not even have a script and only a configuration line that accepts a "command to run", something quite common on CI systems (see travis.ini). Those CI systems may run that code inside or outside a virtualenv. If pip is not able to detect and make use of virtualenv, it make any usage of it much harder because the user would be forced to write wrappers around that code in order to make it work in various contexts. Writing these wrappers is not even possible in some cases (or just hard and ugly due to the need to cope with multiple levels or quoting in order to use bash to implement that missing logic). |
Basically with above you have
The fallback sequences are far simpler this way |
Not sure if I missed it, how would this interact with the set of packages available for import in a Also, is the assumption that for determining whether a dependency is already installed we'd have some of these schemes "inherit" the packages from the packages that would be available in another? Like
|
No changes on that front. This would only affect how a package is installed / unpacked, not how it's built. Things that are currently importable at build time, would stay importable -- basically anything that's on sys.path when running. |
Poking here for feedback on #7164. |
It looks like @takluyver in #7164 (comment) has a nice plan for stopping some of the damage of defaulting to write to system wide packages. #7002 That should hopefully stop much of the damage experienced by newbies. Thank you, thankyou, thanksssss to all involved! 🎈🎉 |
(Re?)iterating that this change is still relevant in a post #7002 world, since this is an internal refactoring-related issue in pip. I'd expect us to start by making refactors to decouple the scheme from the various parts of our codebase (like @chrahunt has started!) and once that's completely/fairly done; we'd start working on the user-facing changes. |
I agree this will hopefully improve the current inconsistent behavior. For example using Python 3.11.3 venv with pip 22.3.1 on Linux, I am able to install a package with the --user option, but if I attempt to uninstall the same package using the same venv/pip, it refuses indicating package is "outside environment" and "Can't uninstall 'mypackage'. No files were found to uninstall." I would expect the uninstall to work given the install was permitted. |
If you have a sudo account, use this command. For example, Amazon Linux 2023 have this issue. |
Just carrying over my idea in #1056 (comment), for proper dedicated discussion.
As @ncoghlan pointed out, this would need some logic to understand that user installs shadow system ones. Also, I would slightly change this to spell it like
--scheme {global,user,venv}
because I like how this signifies exclusiveness of the behaviours better than plain flags do and is consistent with some internal configuration stuff.Additionally, while doing this:
--upgrade-strategy
)./ping @dstufft @pfmoore
The text was updated successfully, but these errors were encountered: