[Python-ideas] Adding Python interpreter info to "pip install"

Al Sweigart asweigart at gmail.com
Thu Jul 19 23:10:47 EDT 2018


 Sorry, I meant "pip list", rather than "pip info".

I thought about the fact that "pip --version" provides this info, but 1) it
provides the location of pip, not the python interpreter it installs
packages for and 2) it would be an additional step for the question-asker
to go through after posting the output of "pip install".

It would be nice to display output that the question-asker can compare
directly with the output of "which python". And I'd like to shorten the
potential amount of back-and-forth before the helper can get the
information they need.

Additionally, while they could always just run "python -m pip install spam"
but most tutorials tell them to run pip directly, so I still see the need
for this.


On Thu, Jul 19, 2018 at 5:50 PM, Chris Angelico <rosuav at gmail.com> wrote:

> On Fri, Jul 20, 2018 at 10:45 AM, Al Sweigart <asweigart at gmail.com> wrote:
> > The goal of this idea is to make it easier to find out when someone has
> > installed packages for the wrong python installation. I'm coming across
> > quite a few StackOverflow posts and emails where beginners are using pip
> to
> > install a package, but then finding they can't import it because they
> have
> > multiple python installations and used the wrong pip.
> >
> > For example, this guy has this problem:
> > https://stackoverflow.com/questions/37662012/which-pip-is-
> with-which-python
> >
> > I'd propose adding a simple line to the output of "pip install" that
> changes
> > this:
> >
> > user at user:~$ pip3 install pyperclip
> > Collecting pyperclip
> > Installing collected packages: pyperclip
> > Successfully installed pyperclip-1.6.2
> >
> > ...to something like this:
> >
> > user at user:~$ pip3 install pyperclip
> > Running pip for /usr/bin/python3
> > Collecting pyperclip
> > Installing collected packages: pyperclip
> > Successfully installed pyperclip-1.6.2
> >
> > This way, when they copy/paste their output to StackOverflow, it'll be
> > somewhat more obvious to their helper that they used pip for the wrong
> > python installation.
> >
> > This info would also be useful for the output of "pip info", but that
> would
> > break scripts that reads that output.
> >
> > Any thoughts?
>
> You can get some very useful information from "pip3 --version". As
> well as pip's own version, it tells you the version of Python that
> it's running under, AND what directory it's being run from. If you
> want to request that similar info be added to other commands, I would
> strongly recommend lifting the exact format of --version and using
> that.
>
> (I'm not sure what "pip info" is, btw. My pip doesn't seem to have that.)
>
> ChrisA
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180719/08b4b560/attachment.html>


More information about the Python-ideas mailing list