Skip to content
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 example command uses wrong pip name #3488

Closed
barry-scott opened this issue Feb 16, 2016 · 9 comments
Closed

pip example command uses wrong pip name #3488

barry-scott opened this issue Feb 16, 2016 · 9 comments
Labels
type: enhancement Improvements to functionality

Comments

@barry-scott
Copy link

On Mac OS X I have lots of python version installed.

$ pip3
You are using pip version 7.1.2, however version 8.0.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

pip on my Mac is the pip for python 2.7.

I suggest that the output should use the argv[0] name of the program not assume "pip" is good.

@damonlynch
Copy link

This is an issue for naive Linux users too.

When they are using a program that calls the python 3 pip, which suggests the upgrade on the terminal, some users then naively attempt to upgrade pip using the suggested command, which is in fact the python 2 version, as Barry points out.

They get into trouble when they prefix sudo in front of the pip command. I'm not sure how exactly (it might be related to the patched version of pip that Debian / Ubuntu / Mint use), but that can cause chaos with the ownership of core directories under ~/.local and other user directories: ownership passes to root, meaning that nothing can be installed with any pip --user / pip3 --user command for that user until the permissions issue is fixed.

@pradyunsg pradyunsg added the type: enhancement Improvements to functionality label Jul 26, 2017
@pradyunsg
Copy link
Member

pradyunsg commented Jul 26, 2017

Sounds good to me in principle.

I don't know what exactly it should be printing though but a case that comes to mind that sys.argv[0] won't work for would be invoking as python -m pip.

I guess we could defer further discussion on this until someone comes up with either an approach or a PR to cleanly handle all these cases.

@pradyunsg pradyunsg added the resolution: deferred till PR Further discussion will happen when a PR is made label Jul 26, 2017
@barry-scott
Copy link
Author

barry-scott commented Jul 26, 2017 via email

@pfmoore
Copy link
Member

pfmoore commented Jul 26, 2017

Yeah, f"{sys.executable} -m pip" is explicit and probably the only guaranteed-accurate option. But do we want to suggest an explicit path every time, like C:\Users\XXXXX\AppData\Local\Programs\Python\Python36\python.exe -m pip? And what if the path contains spaces? Should we quote it so that users can copy and paste the command without problems?

At some point we have to assume the user has a basic understanding of what's going on, and simply strive to not be misleading. So maybe the best thing would be to deliberately not look like something the user can copy and paste, such as

You should consider upgrading via the '<your_python_interpreter> -m pip install --upgrade pip' command.

@damonlynch
Copy link

I give Linux users precisely that command, with the addition of the --user switch. As I recall, on systems where 'python' is python3, there is no 'pip3', which is one reason among others to go with the command that includes the interpreter.

However, seeing the existing message, naive users attempt it without the --user, immediately see the permission failure, and out of habit prepend sudo. Perhaps some use the --user option, but I tend to hear from the ones reporting failure, not success. Do we want unsophisticated users doing that?

@pfmoore
Copy link
Member

pfmoore commented Jul 27, 2017

Honestly, I wonder whether we wouldn't be better not suggesting a command, but just saying "you should consider upgrading pip". There are just so many possible variants on what's the right thing to do (Windows has its own set of things that would go wrong with the current advice) that we're always going to get people making mistakes.

@pradyunsg
Copy link
Member

pradyunsg commented Aug 19, 2017

FTR; this issue is labelled as "deferred till PR".

This label is essentially for indicating that further discussion related to this issue should be deferred until someone comes around to make a PR. This does not mean that the said PR would be accepted - it has not been determined whether this is a useful change to pip and that decision has been deferred until the PR is made.

@gutsytechster
Copy link
Contributor

Shouldn't this be already resolved by #7532?

@DiddiLeija
Copy link
Member

Shouldn't this be already resolved by #7532?

Closing this out.

@DiddiLeija DiddiLeija removed the resolution: deferred till PR Further discussion will happen when a PR is made label Jan 22, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 22, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: enhancement Improvements to functionality
Projects
None yet
Development

No branches or pull requests

6 participants