[Distutils] Re: Is ensurepip still a thing?

2018-08-11 Thread Nick Coghlan
On Wed., 8 Aug. 2018, 7:02 am Chris Barker via Distutils-SIG, <
distutils-sig@python.org> wrote:

> On Tue, Aug 7, 2018 at 9:16 AM, Donald Stufft  wrote:
>
>
>> > Or really, the question at hand: should a user starting from scratch
>> > with a python.org install of 3.7 run ensurepip?
>> >
>> > Or can they just go straight to:
>> >
>> > Python3 -m pip install —upgrade pip
>> >
>>
>> The intention behind ensurepip was that they could just go straight to
>> ``python3 -m pip install -U pip`` because the ensurepip was implicit when
>> they installed Python. However some downstream distributors have mucked
>> around with ensurepip in one way or another (ranging from not running it by
>> default, to out right disabling it).
>
>
> so I *think* that means that ensurepip still has a useful function, but if
> folks install python from the python.org installers (on Windows and OS-X)
> then they can upgrade pip right out of the box -- yes?
>


Yeah, the flow I would suggest is:

1. Try to upgrade pip to the latest
2. Only run ensurepip if the previous command fails with an indication that
pip isn't installed yet

(The python.org installers run ensurepip by default as a post-install step)

Cheers,
Nick.




>
--
Distutils-SIG mailing list -- distutils-sig@python.org
To unsubscribe send an email to distutils-sig-le...@python.org
https://mail.python.org/mm3/mailman3/lists/distutils-sig.python.org/
Message archived at 
https://mail.python.org/mm3/archives/list/distutils-sig@python.org/message/AIMMOTJZ4AWADDVON4NR7QZSN36QQ7D6/


[Distutils] Re: Is ensurepip still a thing?

2018-08-07 Thread Chris Barker via Distutils-SIG
For completeness' sake: accidentally sent offline.

-- Forwarded message --
From: Chung Tzu-ping 
Date: Tue, Aug 7, 2018 at 1:54 PM
Subject: Re: [Distutils] Re: Is ensurepip still a thing?
To: Chris Barker - NOAA Federal 


Replies inline

On 7 Aug 2018, at 23:43, Chris Barker - NOAA Federal 
wrote:

>> IIRC, ensurepip by design doesn't go to the internet , so it will only
>> ever upgrade to the version bundled with Python
>
> Now I’m really confused — if pip is already bundled with Python, then
> what is ensurepip for ?!?!

Yes and no. Python does not have pip pre-installed, but distributions from
python.org comes with a wheel of pip (and one for setuptools) that allows
ensurepip to install pip withou teaching the internet. The files to make
pip work is there, but not available as a module before ensurepip is run.

The purpose of ensurepip is to make the distributed wheels available as the
importable and invokable pip module and command. This is not the only way
to make pip available for a newly-installed Python, but is the way you are
mostly encouraged to do it.

>
> Or really, the question at hand: should a user starting from scratch
> with a python.org install of 3.7 run ensurepip?

Yes. It gives you the pip command and module.

>
> Or can they just go straight to:
>
> Python3 -m pip install —upgrade pip

They can’t. pip cannot be used before you install them, either via
ensurepip or other methods (not encouraged and not discussed here).

>
> ?!?
>
> -CHB
>
>
>> from the docs "To
>> ensure the installed version of pip is *at least as recent as the one
>> bundled with ensurepip*, pass the --upgrade option" [emphasis mine]).
>> To get the latest available version, you should do `python -m pip
>> install --upgrade pip` (better than `pip install...` as it works on
>> Windows) as you mentioned.
>>
>> Paul

--
Tzu-ping Chung (@uranusjr)
uranu...@gmail.com
Sent from my iPhone



On Tue, Aug 7, 2018 at 2:00 PM, Chris Barker  wrote:

> On Tue, Aug 7, 2018 at 9:16 AM, Donald Stufft  wrote:
>
> Ensurepip is the mechanism that Python uses to bundle pip with Python. We
>> didn’t add pip to the stdlib, we added ensurepip to the stdlib. In 3.x the
>> makefiles and macOS/Windows installers will automatically run ensurepip
>> (however in both cases there are flags to disable running ensurepip— but it
>> defaults to On in 3.x).
>
>
> OK -- that makes sense.
>
>
>> > Or really, the question at hand: should a user starting from scratch
>> > with a python.org install of 3.7 run ensurepip?
>> >
>> > Or can they just go straight to:
>> >
>> > Python3 -m pip install —upgrade pip
>> >
>>
>> The intention behind ensurepip was that they could just go straight to
>> ``python3 -m pip install -U pip`` because the ensurepip was implicit when
>> they installed Python. However some downstream distributors have mucked
>> around with ensurepip in one way or another (ranging from not running it by
>> default, to out right disabling it).
>
>
> so I *think* that means that ensurepip still has a useful function, but if
> folks install python from the python.org installers (on Windows and OS-X)
> then they can upgrade pip right out of the box -- yes?
>
> -CHB
>
>
>
>
> --
>
> Christopher Barker, Ph.D.
> Oceanographer
>
> Emergency Response Division
> NOAA/NOS/OR(206) 526-6959   voice
> 7600 Sand Point Way NE   (206) 526-6329   fax
> Seattle, WA  98115   (206) 526-6317   main reception
>
> chris.bar...@noaa.gov
>



-- 

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR(206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115   (206) 526-6317   main reception

chris.bar...@noaa.gov
--
Distutils-SIG mailing list -- distutils-sig@python.org
To unsubscribe send an email to distutils-sig-le...@python.org
https://mail.python.org/mm3/mailman3/lists/distutils-sig.python.org/
Message archived at 
https://mail.python.org/mm3/archives/list/distutils-sig@python.org/message/ZPRPGLYMYEWZQ2UFFUH44NIJ5VFLO7GO/


[Distutils] Re: Is ensurepip still a thing?

2018-08-07 Thread Chris Barker via Distutils-SIG
On Tue, Aug 7, 2018 at 9:16 AM, Donald Stufft  wrote:

Ensurepip is the mechanism that Python uses to bundle pip with Python. We
> didn’t add pip to the stdlib, we added ensurepip to the stdlib. In 3.x the
> makefiles and macOS/Windows installers will automatically run ensurepip
> (however in both cases there are flags to disable running ensurepip— but it
> defaults to On in 3.x).


OK -- that makes sense.


> > Or really, the question at hand: should a user starting from scratch
> > with a python.org install of 3.7 run ensurepip?
> >
> > Or can they just go straight to:
> >
> > Python3 -m pip install —upgrade pip
> >
>
> The intention behind ensurepip was that they could just go straight to
> ``python3 -m pip install -U pip`` because the ensurepip was implicit when
> they installed Python. However some downstream distributors have mucked
> around with ensurepip in one way or another (ranging from not running it by
> default, to out right disabling it).


so I *think* that means that ensurepip still has a useful function, but if
folks install python from the python.org installers (on Windows and OS-X)
then they can upgrade pip right out of the box -- yes?

-CHB




-- 

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR(206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115   (206) 526-6317   main reception

chris.bar...@noaa.gov
--
Distutils-SIG mailing list -- distutils-sig@python.org
To unsubscribe send an email to distutils-sig-le...@python.org
https://mail.python.org/mm3/mailman3/lists/distutils-sig.python.org/
Message archived at 
https://mail.python.org/mm3/archives/list/distutils-sig@python.org/message/UQ2KKFGW6OEJURMZABRDXE5IJIT7S6OA/


[Distutils] Re: Is ensurepip still a thing?

2018-08-07 Thread Donald Stufft

> On Aug 7, 2018, at 11:43 AM, Chris Barker - NOAA Federal via Distutils-SIG 
>  wrote:
> 
>> IIRC, ensurepip by design doesn't go to the internet , so it will only
>> ever upgrade to the version bundled with Python
> 
> Now I’m really confused — if pip is already bundled with Python, then
> what is ensurepip for ?!?!

Ensurepip is the mechanism that Python uses to bundle pip with Python. We 
didn’t add pip to the stdlib, we added ensurepip to the stdlib. In 3.x the 
makefiles and macOS/Windows installers will automatically run ensurepip 
(however in both cases there are flags to disable running ensurepip— but it 
defaults to On in 3.x). Ensurepip is also the mechanism that the venv module 
uses to install pip into a fresh, brand new virtual environment.

> 
> Or really, the question at hand: should a user starting from scratch
> with a python.org install of 3.7 run ensurepip?
> 
> Or can they just go straight to:
> 
> Python3 -m pip install —upgrade pip
> 

The intention behind ensurepip was that they could just go straight to 
``python3 -m pip install -U pip`` because the ensurepip was implicit when they 
installed Python. However some downstream distributors have mucked around with 
ensurepip in one way or another (ranging from not running it by default, to out 
right disabling it).
--
Distutils-SIG mailing list -- distutils-sig@python.org
To unsubscribe send an email to distutils-sig-le...@python.org
https://mail.python.org/mm3/mailman3/lists/distutils-sig.python.org/
Message archived at 
https://mail.python.org/mm3/archives/list/distutils-sig@python.org/message/6BVBYYQ2FBTK7RZL5OZJH2OWRQJQ3DOP/


[Distutils] Re: Is ensurepip still a thing?

2018-08-07 Thread Chris Barker - NOAA Federal via Distutils-SIG
> IIRC, ensurepip by design doesn't go to the internet , so it will only
> ever upgrade to the version bundled with Python

Now I’m really confused — if pip is already bundled with Python, then
what is ensurepip for ?!?!

Or really, the question at hand: should a user starting from scratch
with a python.org install of 3.7 run ensurepip?

Or can they just go straight to:

Python3 -m pip install —upgrade pip

?!?

-CHB


> from the docs "To
> ensure the installed version of pip is *at least as recent as the one
> bundled with ensurepip*, pass the --upgrade option" [emphasis mine]).
> To get the latest available version, you should do `python -m pip
> install --upgrade pip` (better than `pip install...` as it works on
> Windows) as you mentioned.
>
> Paul
--
Distutils-SIG mailing list -- distutils-sig@python.org
To unsubscribe send an email to distutils-sig-le...@python.org
https://mail.python.org/mm3/mailman3/lists/distutils-sig.python.org/
Message archived at 
https://mail.python.org/mm3/archives/list/distutils-sig@python.org/message/XGQ7HMBNLSRG37IMIQ5WXAMEDS6UNLJW/


[Distutils] Re: Is ensurepip still a thing?

2018-08-07 Thread Donald Stufft

> On Aug 7, 2018, at 3:46 AM, Paul Moore  wrote:
> 
> IIRC, ensurepip by design doesn't go to the internet , so it will only
> ever upgrade to the version bundled with Python (from the docs "To
> ensure the installed version of pip is *at least as recent as the one
> bundled with ensurepip*, pass the --upgrade option" [emphasis mine]).
> To get the latest available version, you should do `python -m pip
> install --upgrade pip` (better than `pip install...` as it works on
> Windows) as you mentioned.
> 


This is correct. Although I would like to further improve it to allow at least 
adding a flag that would have it reach out to the internet, if not doing that 
by default and having the installers/makefile use a flag that disable touching 
the internet (the *real* thing we wanted was for the installers and such to not 
reach out to the internet. I think it’s fine if manual invocations of that 
command reach out to the internet).--
Distutils-SIG mailing list -- distutils-sig@python.org
To unsubscribe send an email to distutils-sig-le...@python.org
https://mail.python.org/mm3/mailman3/lists/distutils-sig.python.org/
Message archived at 
https://mail.python.org/mm3/archives/list/distutils-sig@python.org/message/YJIYR22D2RSD4IFWFMZRQJS4IN4JOA3X/


[Distutils] Re: Is ensurepip still a thing?

2018-08-07 Thread Paul Moore
On Tue, 7 Aug 2018 at 02:26, Chris Barker via Distutils-SIG
 wrote:
>
> I'm updating some instructions for my students, in which the first thing I do 
> is have them run ensurepip:
>
> $ python3 -m ensurepip --upgrade
>
> which resulted in:
>
> $  python3 -m ensurepip --upgrade
> Looking in links: /var/folders/ym/tj87fc850yd6526nbrn14rxmgn/T/tmpwc8nd6oj
> Requirement already up-to-date: setuptools in 
> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages 
> (39.0.1)
> Requirement already up-to-date: pip in 
> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages 
> (10.0.1)
>
> (this is after a brand-new python 3.7 install on OS-X from python.org)
>
> All good. But then I use pip, and get (after a successful install):
>
> You are using pip version 10.0.1, however version 18.0 is available.
> You should consider upgrading via the 'pip install --upgrade pip' command.
>
> Huh? shouldn't ensurepip have updated it for me already??

IIRC, ensurepip by design doesn't go to the internet , so it will only
ever upgrade to the version bundled with Python (from the docs "To
ensure the installed version of pip is *at least as recent as the one
bundled with ensurepip*, pass the --upgrade option" [emphasis mine]).
To get the latest available version, you should do `python -m pip
install --upgrade pip` (better than `pip install...` as it works on
Windows) as you mentioned.

Paul
--
Distutils-SIG mailing list -- distutils-sig@python.org
To unsubscribe send an email to distutils-sig-le...@python.org
https://mail.python.org/mm3/mailman3/lists/distutils-sig.python.org/
Message archived at 
https://mail.python.org/mm3/archives/list/distutils-sig@python.org/message/45EINFAXY7U3U3WMUTIYCZTGMAXCZJZO/


[Distutils] Re: Is ensurepip still a thing?

2018-08-06 Thread Wes Turner
Is there a build script that automates vendoring in the latest pip? I see
checkpip.py, which only checks the version.

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

https://www.python.org/dev/peps/pep-0453/#updating-the-private-copy-of-pip

https://github.com/python/cpython/blob/master/Tools/scripts/checkpip.py

https://github.com/pypa/get-pip/blob/master/tasks/generate.py

On Monday, August 6, 2018, Chris Barker via Distutils-SIG <
distutils-sig@python.org> wrote:

> I'm updating some instructions for my students, in which the first thing I
> do is have them run ensurepip:
>
> $ python3 -m ensurepip --upgrade
>
> which resulted in:
>
> $  python3 -m ensurepip --upgrade
> Looking in links: /var/folders/ym/tj87fc850yd6526nbrn14rxmgn
> /T/tmpwc8nd6oj
> Requirement already up-to-date: setuptools in /Library/Frameworks/Python.
> framework/Versions/3.7/lib/python3.7/site-packages (39.0.1)
> Requirement already up-to-date: pip in /Library/Frameworks/Python.
> framework/Versions/3.7/lib/python3.7/site-packages (10.0.1)
>
> (this is after a brand-new python 3.7 install on OS-X from python.org)
>
> All good. But then I use pip, and get (after a successful install):
>
> You are using pip version 10.0.1, however version 18.0 is available.
> You should consider upgrading via the 'pip install --upgrade pip' command.
>
> Huh? shouldn't ensurepip have updated it for me already??
>
> Or should I simply suggest the
>
> pip install --upgrade pip
>
> command and not bother with ensurepip anymore?
>
> BTW -- shouldn't that be:
>
> python3 -m pip install --upgrade pip
>
> to make sure they get the "right" pip?
>
> KInda hard to keep up with the latest ...
>
> Thanks,
>
> -CHB
>
>
>
> --
>
> Christopher Barker, Ph.D.
> Oceanographer
>
> Emergency Response Division
> NOAA/NOS/OR(206) 526-6959   voice
> 7600 Sand Point Way NE   (206) 526-6329   fax
> Seattle, WA  98115   (206) 526-6317   main reception
>
> chris.bar...@noaa.gov
>
--
Distutils-SIG mailing list -- distutils-sig@python.org
To unsubscribe send an email to distutils-sig-le...@python.org
https://mail.python.org/mm3/mailman3/lists/distutils-sig.python.org/
Message archived at 
https://mail.python.org/mm3/archives/list/distutils-sig@python.org/message/UYO7QQ45LRMPOZYVQORZYJNSQ7NHKHLT/