Is ensurepip still a thing?
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/tj87fc850yd6526nbrn14rxm0000gn/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&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker@noaa.gov
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/tj87fc850yd6526nbrn14rxm0000gn /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&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker@noaa.gov
On Tue, 7 Aug 2018 at 02:26, 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/tj87fc850yd6526nbrn14rxm0000gn/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
On Aug 7, 2018, at 3:46 AM, Paul Moore <p.f.moore@gmail.com> 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).
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
On Aug 7, 2018, at 11:43 AM, Chris Barker - NOAA Federal via Distutils-SIG <distutils-sig@python.org> 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).
On Tue, Aug 7, 2018 at 9:16 AM, Donald Stufft <donald@stufft.io> 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&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker@noaa.gov
For completeness' sake: accidentally sent offline. ---------- Forwarded message ---------- From: Chung Tzu-ping <uranusjr@me.com> Date: Tue, Aug 7, 2018 at 1:54 PM Subject: Re: [Distutils] Re: Is ensurepip still a thing? To: Chris Barker - NOAA Federal <chris.barker@noaa.gov> Replies inline On 7 Aug 2018, at 23:43, Chris Barker - NOAA Federal <chris.barker@noaa.gov> 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) uranusjr@gmail.com Sent from my iPhone On Tue, Aug 7, 2018 at 2:00 PM, Chris Barker <chris.barker@noaa.gov> wrote:
On Tue, Aug 7, 2018 at 9:16 AM, Donald Stufft <donald@stufft.io> 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&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker@noaa.gov
-- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker@noaa.gov
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 <donald@stufft.io> 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.
participants (6)
-
Chris Barker -
Chris Barker - NOAA Federal -
Donald Stufft -
Nick Coghlan -
Paul Moore -
Wes Turner