-
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
Better documentation on install --user/--no-user and related envvars #12924
Comments
Citation needed, I guess? When is doing a user-site install a problem instead of sytem-wide? |
When I'm administering a Python environment used by multiple users, for one. I don't think this logic makes much sense. If a user install is always acceptable, why even have the option of doing a system install? |
I administered a Python distribution and needed to turn user installs off, I set up a default pip config with:
You can create it from the command line with My use case was that user installs were breaking conda installations as the base conda environment was read only, pip would install packages into the user site, this would very frequently break Spyder in the base Anaconda environment. This was further problematic because every conda environment on that Python version would pick up packages installed into the user site, so I had to do a lot of user education on not using pip user installs. So, I am very sympathetic to this being the default behaviour, I also know a lot of users of pip have workflows that assume falling back to user installs by default, so it would likely be a hugely disruptive change. |
@notatallshaw Thank you! This is exactly what I was looking for, and works better than the environment variable for my purposes. Although using the config file solves my problem, I think my feature request could be modified to request better documentation related to boolean flags:
|
I agree, there could be better documentation here, when I set that up I made educated guesses about the config. I'm sure PRs would be welcome. |
Can you also update the issue title? When I first saw this in the list of issues I thought it was (still) a discussion about changing the actual behavior and came prepared to argue against such a change... :) |
What's the problem this feature will solve?
When running
pip install
and it is detected that the user does not have permissions to edit site-packages, it defaults to behaving as if the--user
option had been used:I feel like this is problematic for the following reasons:
--user
option explicitly.I just ran into this issue when trying to update a package in a shared conda installation and I forgot to run the command as the maintenance user that own the conda environment directory. My mistake, but it's an easy one to make and I missed the warning amidst all the other output, so I was under the impression that it had done what I wanted. This led to further confusion when tests worked with my account, but failed for other users.
Describe the solution you'd like
Unless the
--user
option is given, check if site-packages is writeable and immediately fail with a useful error message if it not. This is close to the behavior with the undocumented--no-user
option, which shows a message like the following:However the error happens when actually trying to write to site-packages, which is after checking dependences and (if no dependencies need installing/updating and installing from source) building the package. The check is already being done at the beginning by default, ideally I think it should fail immediately instead of continuing until the actual permissions error is encountered.
Changing the default behavior breaks backward compatibility, but the new behavior could be enabled through an environment variable.
Alternative Solutions
There is the (undocumented)
--no-user
option, but if I remember to type that every time then I'm remembering to be on the lookout for the issue anyway.Additional context
(none)
Code of Conduct
The text was updated successfully, but these errors were encountered: