[Django] #30367: Docs: Change examples using bare `pip ...` to `python -m pip ...`

11 views
Skip to first unread message

Django

unread,
Apr 14, 2019, 11:01:22 AM4/14/19
to django-...@googlegroups.com
#30367: Docs: Change examples using bare `pip ...` to `python -m pip ...`
------------------------------------------------+------------------------
Reporter: Ramiro Morales | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
------------------------------------------------+------------------------
Perhaps a minor detail in these times in which Django is Python3-only and
usage of some form of virtualenv/minimal container is ubiquitous. But
posting for consideration anyways just in case.

Using `python -m pip install foo`makes sure the copy of `pip` looked up
and executed is the one installed for the interpreter copy currently in
use (be it a system-wide or a virtualenv's)

This reduces the chances of failure (wrong `pip`gets used and the install
fails confusing the user or even worse the intended install action
succeeds but against another copy of Python) in broken setups in which a
leftover Python2 `pip` or one associated with a different Python 3.x
install is located in a directory which appears earlier in `$PATH`.

Inspired by this article by Brett Cannon: https://snarky.ca
/deconstructing-xkcd-com-1987/

Quoting:

> Having `pip` installed is not a shocker. The real question is ''what''
interpreter pip is attached to? That's dependent on which Python
interpreter was installed '''last''' in the ''earliest'' directory to have
a Python interpreter in it. This is why you should always use `python -m
pip` when executing pip to guarantee you are using pip with the
interpreter you intend to install for.

--
Ticket URL: <https://code.djangoproject.com/ticket/30367>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Apr 14, 2019, 11:25:49 AM4/14/19
to django-...@googlegroups.com
#30367: Docs: Change examples using bare `pip ...` to `python -m pip ...`
-------------------------------------+-------------------------------------
Reporter: Ramiro Morales | Owner: Ramiro
Type: | Morales
Cleanup/optimization | Status: assigned
Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Ramiro Morales):

* owner: nobody => Ramiro Morales
* status: new => assigned
* has_patch: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/30367#comment:1>

Django

unread,
Apr 15, 2019, 2:13:13 PM4/15/19
to django-...@googlegroups.com
#30367: Docs: Change examples using bare `pip ...` to `python -m pip ...`
-------------------------------------+-------------------------------------
Reporter: Ramiro Morales | Owner: Ramiro
Type: | Morales
Cleanup/optimization | Status: assigned
Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 1

Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tobias Kunze):

* needs_better_patch: 0 => 1
* stage: Unreviewed => Accepted


Comment:

I think this makes sense. It's a bit more verbose, but removes a source of
errors that are particularly hard to debug for beginners.

--
Ticket URL: <https://code.djangoproject.com/ticket/30367#comment:2>

Django

unread,
Apr 16, 2019, 7:01:17 AM4/16/19
to django-...@googlegroups.com
#30367: Docs: Change examples using bare `pip ...` to `python -m pip ...`
-------------------------------------+-------------------------------------
Reporter: Ramiro Morales | Owner: Ramiro
Type: | Morales
Cleanup/optimization | Status: assigned
Component: Documentation | Version: master

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Ramiro Morales):

* needs_better_patch: 1 => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/30367#comment:3>

Django

unread,
Apr 16, 2019, 7:03:16 AM4/16/19
to django-...@googlegroups.com
#30367: Docs: Change examples using bare `pip ...` to `python -m pip ...`
-------------------------------------+-------------------------------------
Reporter: Ramiro Morales | Owner: Ramiro
Type: | Morales
Cleanup/optimization | Status: assigned
Component: Documentation | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Tobias Kunze):

* stage: Accepted => Ready for checkin


--
Ticket URL: <https://code.djangoproject.com/ticket/30367#comment:4>

Django

unread,
Apr 18, 2019, 11:57:09 AM4/18/19
to django-...@googlegroups.com
#30367: Docs: Change examples using bare `pip ...` to `python -m pip ...`
-------------------------------------+-------------------------------------
Reporter: Ramiro Morales | Owner: Ramiro
Type: | Morales
Cleanup/optimization | Status: closed
Component: Documentation | Version: master
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak <felisiak.mariusz@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"aed89adad54a977829c4f180b036033e031ebcc7" aed89ada]:
{{{
#!CommitTicketReference repository=""
revision="aed89adad54a977829c4f180b036033e031ebcc7"
Fixed #30367 -- Changed "pip install" to "python -m pip install" in docs,
comments and hints.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/30367#comment:5>

Django

unread,
Dec 23, 2020, 11:21:36 AM12/23/20
to django-...@googlegroups.com
#30367: Docs: Change examples using bare `pip ...` to `python -m pip ...`
-------------------------------------+-------------------------------------
Reporter: Ramiro Morales | Owner: Ramiro
Type: | Morales
Cleanup/optimization | Status: closed
Component: Documentation | Version: master

Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Carlton Gibson <carlton@…>):

In [changeset:"429d089d0a8fbd400e0c010708df4f0d16218970" 429d089]:
{{{
#!CommitTicketReference repository=""
revision="429d089d0a8fbd400e0c010708df4f0d16218970"
Refs #30367 -- Changed remaining "pip install" to "python -m pip install"
in docs.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/30367#comment:6>

Django

unread,
Dec 23, 2020, 11:24:48 AM12/23/20
to django-...@googlegroups.com
#30367: Docs: Change examples using bare `pip ...` to `python -m pip ...`
-------------------------------------+-------------------------------------
Reporter: Ramiro Morales | Owner: Ramiro
Type: | Morales
Cleanup/optimization | Status: closed
Component: Documentation | Version: master

Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Carlton Gibson <carlton.gibson@…>):

In [changeset:"6165e23776b146a587ee21bc468b1e645b4dd890" 6165e237]:
{{{
#!CommitTicketReference repository=""
revision="6165e23776b146a587ee21bc468b1e645b4dd890"
[3.1.x] Refs #30367 -- Changed remaining "pip install" to "python -m pip
install" in docs.

Backport of 429d089d0a8fbd400e0c010708df4f0d16218970 from master.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/30367#comment:7>

Reply all
Reply to author
Forward
0 new messages