Skip to content

Commit e3e1b16

Browse files
committed
Merge pull request pypa#129 from qwcode/install_topics
push all the install examples into top-level sections
2 parents dc3dc17 + 59af0b0 commit e3e1b16

File tree

1 file changed

+122
-71
lines changed

1 file changed

+122
-71
lines changed

source/installing.rst

+122-71
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
Tutorial on Installing Packages
33
===============================
44

5-
:Page Status: Complete
6-
:Last Reviewed: 2014-09-30
5+
:Page Status: Incomplete
6+
:Last Reviewed: 2014-12-24
77

88
.. contents:: Contents
99
:local:
@@ -26,12 +26,8 @@ distribution, or another larger software distribution like Python itself.
2626
Setup for Installing Packages
2727
=============================
2828

29-
This section describes the steps to follow before installing other
30-
Python packages. You will want to install :ref:`pip` and
31-
:ref:`setuptools`, and in most cases, :ref:`virtualenv` (unless you're using
32-
`pyvenv`_).
33-
34-
We recommend the following installation sequence:
29+
This section describes the steps to follow before installing other Python
30+
packages.
3531

3632
1. Install :ref:`pip` and :ref:`setuptools`: [3]_
3733

@@ -71,8 +67,8 @@ We recommend the following installation sequence:
7167

7268
.. _`Creating and using Virtual Environments`:
7369

74-
Virtual Environments
75-
====================
70+
Creating Virtual Environments
71+
=============================
7672

7773
Python "Virtual Environments" allow Python :term:`packages <Distribution
7874
Package>` to be installed in an isolated location for a particular application,
@@ -124,15 +120,22 @@ For more information, see the `virtualenv <http://virtualenv.pypa.io>`_ docs or
124120
the `pyvenv`_ docs.
125121

126122

127-
Installing Python Packages
128-
==========================
123+
Use pip for Installing
124+
======================
125+
126+
:ref:`pip` is the recommended installer. Below, we'll cover the most common
127+
usage scenarios. For more detail, see the `pip docs <https://pip.pypa.io>`_,
128+
which includes a complete `Reference Guide
129+
<https://pip.pypa.io/en/latest/reference/index.html>`_.
129130

130-
:ref:`pip` is the recommended installer, and supports various requirement forms
131-
and options. For details, see the `pip docs
132-
<https://pip.pypa.io>`_.
131+
There are a few cases where you might want to use `easy_install
132+
<https://pip.pypa.io/en/latest/reference/index.html>`_ instead of pip. For
133+
details, see the the :ref:`pip vs easy_install` breakdown in the :doc:`Advanced
134+
Topics <additional>` section.
133135

134-
Examples
135-
--------
136+
137+
Installing from PyPI
138+
====================
136139

137140
Install `SomeProject` and its dependencies from :term:`PyPI <Python Package
138141
Index (PyPI)>` using :ref:`pip:Requirement Specifiers`
@@ -144,21 +147,78 @@ Index (PyPI)>` using :ref:`pip:Requirement Specifiers`
144147
pip install 'SomeProject>=1.0.4' # minimum version
145148

146149

147-
Install a list of requirements specified in a :ref:`Requirements File
148-
<pip:Requirements Files>`.
150+
Upgrading packages
151+
==================
152+
153+
Upgrade an already installed `SomeProject` to the latest from PyPI.
149154

150155
::
151156

152-
pip install -r requirements.txt
157+
pip install --upgrade SomeProject
153158

154159

155-
Upgrade an already installed `SomeProject` to the latest from PyPI.
160+
Installing Cached Wheels
161+
========================
162+
163+
:term:`Wheel` is a pre-built :term:`distribution <Distribution Package>` format that
164+
provides faster installation compared to :term:`Source Distributions (sdist)
165+
<Source Distribution (or "sdist")>`, especially when a project contains compiled
166+
extensions.
167+
168+
As of v1.5, :ref:`pip` prefers :term:`wheels <Wheel>` over :term:`sdists <Source
169+
Distribution (or "sdist")>` when searching indexes.
170+
171+
Although wheels are `becoming more common <http://pythonwheels.com>`_ on
172+
:term:`PyPI <Python Package Index (PyPI)>`, if you want all of your dependencies
173+
converted to wheel, do the following (assuming you're using a :ref:`Requirements
174+
File <pip:Requirements Files>`):
156175

157176
::
158177

159-
pip install --upgrade SomeProject
178+
pip wheel --wheel-dir=/local/wheels -r requirements.txt
179+
180+
And then to install those requirements just using your local directory of wheels
181+
(and not from PyPI):
182+
183+
::
184+
185+
pip install --no-index --find-links=/local/wheels -r requirements.txt
186+
187+
188+
:term:`Wheel` is intended to replace :term:`Eggs <Egg>`. For a detailed
189+
comparison, see :ref:`Wheel vs Egg`.
190+
191+
192+
Installing to the User Site
193+
===========================
194+
195+
To install :term:`packages <Distribution Package>` that are isolated to the
196+
current user, use the ``--user`` flag:
197+
198+
::
199+
200+
pip install --user SomeProject
160201

161202

203+
For more information see the `User Installs
204+
<https://pip.readthedocs.org/en/latest/user_guide.html#user-installs>`_ section
205+
from the pip docs.
206+
207+
208+
Requirements files
209+
==================
210+
211+
Install a list of requirements specified in a :ref:`Requirements File
212+
<pip:Requirements Files>`.
213+
214+
::
215+
216+
pip install -r requirements.txt
217+
218+
219+
Installing from VCS
220+
===================
221+
162222
Install a project from VCS in "editable" mode. For a full breakdown of the
163223
syntax, see pip's section on :ref:`VCS Support <pip:VCS Support>`.
164224

@@ -170,13 +230,8 @@ syntax, see pip's section on :ref:`VCS Support <pip:VCS Support>`.
170230
pip install -e git+https://git.repo/some_pkg.git@feature#egg=SomeProject # from a branch
171231

172232

173-
Install a particular source archive file.
174-
175-
::
176-
177-
pip install ./downloads/SomeProject-1.0.4.tar.gz
178-
pip install http://my.package.repo/SomeProject-1.0.4.zip
179-
233+
Installing from other Indexes
234+
=============================
180235

181236
Install from an alternate index
182237

@@ -193,76 +248,70 @@ Package Index (PyPI)>`
193248
pip install --extra-index-url http://my.package.repo/simple SomeProject
194249

195250

196-
Install from a local directory containing archives (and don't check :term:`PyPI
197-
<Python Package Index (PyPI)>`)
198-
199-
::
200251

201-
pip install --no-index --find-links=file:///local/dir/ SomeProject
202-
pip install --no-index --find-links=/local/dir/ SomeProject
203-
pip install --no-index --find-links=relative/dir/ SomeProject
252+
Installing from a local src tree
253+
================================
204254

205255

206-
Find pre-release and development versions, in addition to stable versions. By
207-
default, pip only finds stable versions.
256+
Installing from local src in `Development Mode
257+
<http://pythonhosted.org/setuptools/setuptools.html#development-mode>`_, i.e. in
258+
such a way that the project appears to be installed, but yet is still editable
259+
from the src tree.
208260

209261
::
210262

211-
pip install --pre SomeProject
263+
pip install -e <path>
212264

213-
Install a package with `setuptools extras`_.
214-
::
215265

216-
$ pip install SomePackage[PDF]
217-
$ pip install SomePackage[PDF]==3.0
218-
$ pip install -e .[PDF]==3.0 # editable project in current directory
266+
You can also normally from src
219267

220-
Wheels
221-
------
268+
::
222269

223-
:term:`Wheel` is a pre-built :term:`distribution <Distribution Package>` format that
224-
provides faster installation compared to :term:`Source Distributions (sdist)
225-
<Source Distribution (or "sdist")>`, especially when a project contains compiled
226-
extensions.
270+
pip install <path>
227271

228-
As of v1.5, :ref:`pip` prefers :term:`wheels <Wheel>` over :term:`sdists <Source
229-
Distribution (or "sdist")>` when searching indexes.
230272

231-
Although wheels are `becoming more common <http://pythonwheels.com>`_ on
232-
:term:`PyPI <Python Package Index (PyPI)>`, if you want all of your dependencies
233-
converted to wheel, do the following (assuming you're using a :ref:`Requirements
234-
File <pip:Requirements Files>`):
273+
Installing from local archives
274+
==============================
275+
276+
Install a particular source archive file.
235277

236278
::
237279

238-
pip wheel --wheel-dir=/local/wheels -r requirements.txt
280+
pip install ./downloads/SomeProject-1.0.4.tar.gz
239281

240-
And then to install those requirements just using your local directory of wheels
241-
(and not from PyPI):
242282

243-
::
283+
Install from a local directory containing archives (and don't check :term:`PyPI
284+
<Python Package Index (PyPI)>`)
244285

245-
pip install --no-index --find-links=/local/wheels -r requirements.txt
286+
::
246287

288+
pip install --no-index --find-links=file:///local/dir/ SomeProject
289+
pip install --no-index --find-links=/local/dir/ SomeProject
290+
pip install --no-index --find-links=relative/dir/ SomeProject
247291

248-
:term:`Wheel` is intended to replace :term:`Eggs <Egg>`. For a detailed
249-
comparison, see :ref:`Wheel vs Egg`.
250292

251293

252-
User Installs
253-
-------------
294+
Installing Prereleases
295+
======================
254296

255-
To install :term:`packages <Distribution Package>` that are isolated to the
256-
current user, use the ``--user`` flag:
297+
Find pre-release and development versions, in addition to stable versions. By
298+
default, pip only finds stable versions.
257299

258300
::
259301

260-
pip install --user SomeProject
302+
pip install --pre SomeProject
261303

262304

263-
For more information see the `User Installs
264-
<https://pip.readthedocs.org/en/latest/user_guide.html#user-installs>`_ section
265-
from the pip docs.
305+
Installing Setuptools "Extras"
306+
==============================
307+
308+
Install `setuptools extras`_.
309+
310+
::
311+
312+
$ pip install SomePackage[PDF]
313+
$ pip install SomePackage[PDF]==3.0
314+
$ pip install -e .[PDF]==3.0 # editable project in current directory
266315

267316

268317

@@ -288,5 +337,7 @@ from the pip docs.
288337
pre-installed, thereby making it an equal alternative to
289338
:ref:`virtualenv`.
290339
340+
.. [5]
341+
291342
.. _pyvenv: http://docs.python.org/3.4/library/venv.html
292343
.. _setuptools extras: http://packages.python.org/setuptools/setuptools.html#declaring-extras-optional-features-with-their-own-dependencies

0 commit comments

Comments
 (0)