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

2018-07-20 Thread Chris Angelico
On Fri, Jul 20, 2018 at 5:56 PM, Thomas Jollans  wrote:
> On 20/07/18 05:10, Al Sweigart wrote:
>> 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".
>
> If the extra line of output was something like
>
> This is $(pip --version)
>
> that would be more consistent, and provide enough information.

Yes, that's what I was saying. It would remove the extra step, at the
price of one line of spam every 'pip install'. Is that worth it? Not
sure, but at least it's not a whole lot of complexity.

ChrisA
___
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/


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

2018-07-20 Thread Thomas Jollans
On 20/07/18 05:10, Al Sweigart wrote:
> 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".

If the extra line of output was something like

This is $(pip --version)

that would be more consistent, and provide enough information.

> 
> 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  > wrote:
> 
> On Fri, Jul 20, 2018 at 10:45 AM, Al Sweigart  > 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@user:~$ pip3 install pyperclip
> > Collecting pyperclip
> > Installing collected packages: pyperclip
> > Successfully installed pyperclip-1.6.2
> >
> > ...to something like this:
> >
> > user@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@python.org 
> https://mail.python.org/mailman/listinfo/python-ideas
> 
> Code of Conduct: http://python.org/psf/codeofconduct/
> 
> 
> 
> 
> 
> ___
> Python-ideas mailing list
> Python-ideas@python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
> 

___
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/


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

2018-07-20 Thread Terry Reedy

On 7/20/2018 12:21 AM, Nathaniel Smith wrote:

On Thu, Jul 19, 2018 at 5:45 PM, Al Sweigart  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.


So have I.  The solution is to run pip the way the core developers 
recommend, which is to explicitly run the version of python you want pip 
to install to.  On Windows,


py -x.y -m pip install somemod

I have given that answer on SO and just gave it on python-list, thereby 
solving the users 2.7 versus 3.7 problem.



This sounds like a great idea to me, but pip is developer separately
from python itself, and I don't think the pip maintainers monitor
python-ideas. I'd suggest filing a feature request on the pip tracker:

https://github.com/pypa/pip/issues/new?template=feature-request.md


Definitely.


--
Terry Jan Reedy

___
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/


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

2018-07-19 Thread Pradyun Gedam
On Fri, 20 Jul 2018, 09:52 Nathaniel Smith,  wrote:

> On Thu, Jul 19, 2018 at 5:45 PM, Al Sweigart  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.
>
> This sounds like a great idea to me, but pip is developer separately
> from python itself, and I don't think the pip maintainers monitor
> python-ideas.


At least one (me) does lurk here. ;)

I'd suggest filing a feature request on the pip tracker:
>
> https://github.com/pypa/pip/issues/new?template=feature-request.md


I second this suggestion to file a feature request for this on the tracker.

Additionally, you should also take a look to see if this has been filed
already since I do remember having a discussion where this came. :)

--
Pradyun


> -n
>
> --
> Nathaniel J. Smith -- https://vorpus.org
> ___
> Python-ideas mailing list
> Python-ideas@python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
___
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/


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

2018-07-19 Thread Wes Turner
`python -m site` and its docs may also be useful for troubleshooting
end-user installations.

A diagnostic script with e.g. these commands could also be helpful:

which python
which pip
python -m site  # sys.path, USER_SITE (pip --user)
python -m pip --version

>>> print((os.name, sys.platform, platform.system()))


https://docs.python.org/3/library/site.html

"""
The site module also provides a way to get the user directories from the
command line:

$ python3 -m site --user-site
/home/user/.local/lib/python3.3/site-packages

If it is called without arguments, it will print the contents of sys.path
on the standard output, followed by the value of USER_BASE and whether the
directory exists, then the same thing for USER_SITE, and finally the value
of ENABLE_USER_SITE.

--user-base

Print the path to the user base directory.

--user-site

Print the path to the user site-packages directory.

If both options are given, user base and user site will be printed (always
in this order), separated by os.pathsep.

If any option is given, the script will exit with one of these values: O if
the user site-packages directory is enabled, 1 if it was disabled by the
user, 2 if it is disabled for security reasons or by an administrator, and
a value greater than 2 if there is an error.
"""


On Friday, July 20, 2018, Nathaniel Smith  wrote:

> On Thu, Jul 19, 2018 at 5:45 PM, Al Sweigart  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.
>
> This sounds like a great idea to me, but pip is developer separately
> from python itself, and I don't think the pip maintainers monitor
> python-ideas. I'd suggest filing a feature request on the pip tracker:
>
> https://github.com/pypa/pip/issues/new?template=feature-request.md
>
> -n
>
> --
> Nathaniel J. Smith -- https://vorpus.org
> ___
> Python-ideas mailing list
> Python-ideas@python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
___
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/


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

2018-07-19 Thread Nathaniel Smith
On Thu, Jul 19, 2018 at 5:45 PM, Al Sweigart  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.

This sounds like a great idea to me, but pip is developer separately
from python itself, and I don't think the pip maintainers monitor
python-ideas. I'd suggest filing a feature request on the pip tracker:

https://github.com/pypa/pip/issues/new?template=feature-request.md

-n

-- 
Nathaniel J. Smith -- https://vorpus.org
___
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/


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

2018-07-19 Thread Abdur-Rahmaan Janhangeer
as it requires only a log, i think it is worth it as pip acts covertly
meaning you don't see which pip is being used in a multi-py environment,
yes you can have version pip info

Abdur-Rahmaan Janhangeer
https://github.com/Abdur-rahmaanJ
Mauritius


>
>
___
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/


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

2018-07-19 Thread Al Sweigart
 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  wrote:

> On Fri, Jul 20, 2018 at 10:45 AM, Al Sweigart  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@user:~$ pip3 install pyperclip
> > Collecting pyperclip
> > Installing collected packages: pyperclip
> > Successfully installed pyperclip-1.6.2
> >
> > ...to something like this:
> >
> > user@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@python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
___
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/


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

2018-07-19 Thread Chris Angelico
On Fri, Jul 20, 2018 at 10:45 AM, Al Sweigart  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@user:~$ pip3 install pyperclip
> Collecting pyperclip
> Installing collected packages: pyperclip
> Successfully installed pyperclip-1.6.2
>
> ...to something like this:
>
> user@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@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/