-
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 install --user should check that the user's $PATH is correct #3813
Comments
I think this is a good idea, although my one worry is that some RC files exclude directories that don't already exist so that's a bit of a weird case where it would be in their I'm sort of hovering between -0 and -1 on something like |
I guess I'm currently +0 on
For concreteness, I'm imagining a user interaction that would look something like
|
Oh, and on this point: Fedora/RH unconditionally add Debian/Ubuntu have historically done the annoying thing you mention with Is there anyone else you're worried about in particular? |
I've seen plenty of other 3rd party python distributions maul people's |
@Ivoz: the difference is that (a) this path is always supposed to be there, there's no sense in which a user might "uninstall" their "Don't mess with user profiles" isn't an option -- unless we want to disable |
So here's a question, it seems to me that we can get most of the way there by just having a suggested snippet in the error message without any sort of fix-me-up command. Yes it'll require them to copy/paste but I think it's a fairly trivial operation for them to do that, and we avoid any sort of "pip broke my profile" issues. |
Er, my question being, why not just do that? |
That would also be a lot better than what we have now :-). (Do keep in mind though that a large chunk of pip's userbase does not know what a "shell" is, or what a "dot-file" is, or even what a "text editor" is ("you mean like Google Docs?")... trivial is a relative term :-)) |
A cross-platform bash $ source <(pip fix-me-up-source) e.g. travis-ci/travis-ci#6247 could use something like that, so they dont need to hard-code the path names. And it could be the basis for users automating the $ pip fix-me-up-source >> ~/.profile Alternatively, is there some way to to ask pip to emit the relevant directories it will use, in a machine readable format, sort of like what |
For CI scripts you probably just want to use virtualenvs or something instead of
Maybe that should be a different bug, since this one is aimed at trying to fix a papercut that bites new users? (While you're at it, a similar thing I've been annoyed by is that there's no way to ask pip to say what wheels it thinks can be installed in the current environment.) |
The issue is known to be happening on Debian/Ubuntu systems because they do not add `~/.local/bin` to the path as said in <pypa/pip#3813>. It looks like it is being solved on Debian testing by automatically add this. Pip devs do not seem to develop a given fix on that.
for info, I think there is a similar problem on windows? I just tried on win 10 VM, and pip install --user put my script in |
Cross linking to #3813 because it has a dependency on this. |
@pradyunsg |
Well, yes. I posted this on the wrong one. I'm sleepy. |
Cross linking to #1668 because it has a dependency on this. |
It does. I'll tag it. :) |
I just released https://github.com/ofek/pybin to ameliorate this issue. Please let me know how this works for anyone that tries it! |
Thoughts on adding a |
Personally I think the right way is to do this check during the install and make it a warning. An additional command someone has to remember to call seems like most folks would just forget to do it. |
I agree with Donald - the most useful place for a warning would be during installations where the package actually puts something in the sysconfig I'm not sure of the best place to hook this in to pip's processing, but one way to go would be to call |
This is the response I was expecting. Just wanted to make sure of it before
moving forward.
I have an open PR for the warning mechanism with wheels. I'll rebase it or
merge the current master into it when I get in front of a bigger screen, in
a few hours. I'm still unsure about what the warning should say though...
As always, any inputs on that PR are more than welcome. :)
|
On Unix,
pip install --user ...
drops scripts into~/.local/bin
. Historically, this directory has not been on the default Debian/Ubuntu$PATH
.This is hopefully on its way to being fixed (bash 4.3-15 is on its way into Debian unstable now, and should hopefully land in Debian testing in a few weeks, bug report here; the Ubuntu bug that will hopefully be used to justify a backport of this fix into Xenial is here). But, even once the fix lands, all it will do is change the default for newly created accounts -- so for a long time, there are going to be people who try running
pip install --user
and end up with it dropping executables into a directory that's not on$PATH
.When
pip install --user
installs a script into~/.local/bin
(or the equivalent on other OSes, why not), then it should check the currentos.environ["PATH"]
, and if this directory is not on thePATH
, then it should print an explanatory message that warns the user and gives them some information on how to fix the problem.(Or heck, it could even suggest they run
pip fix-user-path
to have pip automatically add tihs to their~/.profile
-- it's a little wonky but not too hard to make reasonably robust, and if it's a manual action that tells the user what it's doing as it runs then it should be reasonable helpful.)(This would be a reasonable first fix for someone new to pip -- does pip's issue tracker have a tag for those?)
The text was updated successfully, but these errors were encountered: