Skip to content

Commit 97d9599

Browse files
committed
Update installing.rst
Mostly prompted by pypa#1079, but also addresses a few concerns about promoting good security practices as discussed on distutils-sig over the past few months :)
1 parent c0e374c commit 97d9599

File tree

1 file changed

+64
-25
lines changed

1 file changed

+64
-25
lines changed

docs/installing.rst

Lines changed: 64 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ pip works on Unix/Linux, OS X, and Windows.
2727
Using virtualenv
2828
----------------
2929

30-
The easiest way to install and use pip is with `virtualenv
31-
<http://www.virtualenv.org>`_, since every virtualenv has pip (and it's dependencies) installed into it
30+
If you already have virtualenv installed, then the easiest way to use pip is through `virtualenv
31+
<http://www.virtualenv.org>`_, since every virtualenv has pip (and its dependencies) installed into it
3232
automatically.
3333

3434
This does not require root access or modify your system Python
@@ -40,18 +40,66 @@ installation. For instance::
4040

4141
When used in this manner, pip will only affect the active virtual environment.
4242

43-
See the `virtualenv installation instructions <http://www.virtualenv.org/en/latest/#installation>`_.
43+
The `virtualenv installation instructions <http://www.virtualenv.org/en/latest/#installation>`_ suggest
44+
using pip to install it if you don't already have it, though, so if the first command above doesn't work
45+
try the next section.
4446

45-
Installing Globally
46-
-------------------
47+
48+
Bootstrapping pip and virtualenv
49+
--------------------------------
50+
51+
Linux
52+
~~~~~
53+
54+
On Linux, pip and virtualenv will generally be available through the system package manager.
55+
For global installation into the system Python, it is recommended to use the system package
56+
manager versions, and then use virtualenv as described above.
57+
58+
On Debian and Ubuntu::
59+
60+
$ sudo apt-get install python-pip python-virtualenv
61+
62+
On Fedora::
63+
64+
$ sudo yum install python-pip python-virtualenv
65+
66+
While these may not always be the most up to date versions of ``pip``, virtualenv should still install a
67+
recent version into the individual virtual environments.
68+
69+
Other operating systems (including Windows and Mac OS X)
70+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
71+
72+
On other operating systems, the following commands should install pip for the current user::
73+
74+
$ curl -O https://raw.github.com/pypa/pip/master/contrib/get-pip.py
75+
$ python get-pip.py --user
76+
77+
If you don't have ``curl`` installed (for example, on Windows) you can download ``get-pip.py``
78+
from the given URL and run it as shown in the second command.
79+
80+
Once you have pip installed, you can use it to retrieve virtualenv::
81+
82+
$ pip install --user virtualenv
83+
84+
And then proceed to use virtualenv as shown above.
85+
86+
87+
Installing pip for all users
88+
----------------------------
4789

4890
pip can be installed globally in order to manage global packages.
49-
Often this requires the installation to be performed as root.
91+
As this typically requires the installation to be performed with administrator
92+
privileges, and (on Linux systems) may conflict with packages provided through
93+
the system package manager, it is *not* the recommended approach.
5094

51-
.. warning::
95+
The simplest way to perform a global installation is to use the bootstrapping
96+
instruction above, but running the get-pip.py script with additional privileges.
97+
However, since running a script you downloaded from the internet with that level
98+
of access to your system should worry you, here are some more detailed instructions
99+
on the steps involved.
52100

53-
We advise against using `easy_install <http://pythonhosted.org/setuptools/easy_install.html>`_ to install pip, because easy_install
54-
does not download from PyPI over SSL, so the installation might be insecure.
101+
Note: the instructions below won't work on Windows. Windows users are strongly encouraged
102+
to use the per user bootstrapping described above.
55103

56104
.. _`Installation Requirements`:
57105

@@ -75,7 +123,7 @@ like so::
75123

76124
pip install --upgrade setuptools
77125

78-
If you had distribute before, this will upgrade to you distribute-0.7.X, which
126+
If you had distribute before, this will upgrade you to distribute-0.7.X, which
79127
is just a wrapper, that depends on setuptools. The end result will be that you
80128
have distribute-0.7.X (which does nothing) *and* the latest setuptools
81129
installed.
@@ -84,23 +132,14 @@ installed.
84132
.. _setuptools: https://pypi.python.org/pypi/setuptools
85133
.. _distribute: https://pypi.python.org/pypi/distribute
86134

87-
88-
Using get-pip
89-
+++++++++++++
90-
91-
::
92-
93-
$ curl -O https://raw.github.com/pypa/pip/master/contrib/get-pip.py
94-
$ [sudo] python get-pip.py
95-
96-
97-
Installing from source
98-
++++++++++++++++++++++
99-
100-
::
135+
Once a suitable version of setuptools is available, pip can be installed
136+
from source::
101137

102138
$ curl -O https://pypi.python.org/packages/source/p/pip/pip-X.X.tar.gz
103139
$ tar xvfz pip-X.X.tar.gz
104140
$ cd pip-X.X
105-
$ [sudo] python setup.py install
141+
$ sudo python setup.py install
106142

143+
Since even these more explicit instructions still involve running an arbitrary
144+
script from the internet with elevated privileges, the user level bootstrapping
145+
described above is *strongly* recommended.

0 commit comments

Comments
 (0)