Skip to content

Commit 2463a07

Browse files
committed
Merge pull request #164 from qwcode/install_updates
Installation Tutorial updates
2 parents 5eee8ef + 4767674 commit 2463a07

2 files changed

Lines changed: 47 additions & 61 deletions

File tree

‎source/distributing.rst‎

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,7 @@ Requirements for Packaging and Distributing
2828
1. First, make sure you have already fulfilled the :ref:`requirements for
2929
installing packages <installing_requirements>`.
3030

31-
2. Install "wheel" [1]_:
32-
33-
::
34-
35-
pip install wheel
36-
37-
You'll need this to package your project into :term:`wheels <Wheel>` (see
38-
:ref:`below <Packaging Your Project>`).
39-
40-
3. Install "twine" [1]_:
31+
2. Install "twine" [1]_:
4132

4233
::
4334

@@ -414,6 +405,8 @@ For more information, see `Automatic Script Creation
414405
<http://pythonhosted.org/setuptools/setuptools.html#automatic-script-creation>`_
415406
from the `setuptools docs <http://pythonhosted.org/setuptools/setuptools.html>`_.
416407

408+
.. _`Choosing a versioning scheme`:
409+
417410
Choosing a versioning scheme
418411
----------------------------
419412

‎source/installing.rst‎

Lines changed: 44 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
Installing Packages
33
===================
44

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

88
This section covers the basics of how to install Python :term:`packages
99
<Distribution Package>`.
@@ -30,22 +30,35 @@ Requirements for Installing Packages
3030
This section describes the steps to follow before installing other Python
3131
packages.
3232

33-
1. Install :ref:`pip` and :ref:`setuptools`: [3]_
33+
1. Install :ref:`pip`, :ref:`setuptools`, and :ref:`wheel`:
3434

35-
If you have a :ref:`PEP453 <pypa:PEP453s>`-compliant Python 3.4, it may
36-
already have the ``pip`` command available by default (and setuptools will be
37-
installed as well), or it may at least contain a working `ensurepip
38-
<https://docs.python.org/3.4/library/ensurepip.html>`_. To install pip (and
39-
setuptools) using ensurepip, run: ``python -m ensurepip --upgrade``.
35+
If you have Python 2 >=2.7.9 or Python 3 >=3.4:
36+
37+
You may already have the ``pip`` command available by default (and
38+
setuptools will be installed as well), or you may at least contain a
39+
working `ensurepip
40+
<https://docs.python.org/3.4/library/ensurepip.html>`_. To install pip (and
41+
setuptools) using ensurepip, run: ``python -m ensurepip --upgrade``.
42+
43+
Since :ref:`wheel` won't be installed, you'll also need to run: ``pip
44+
install wheel``
4045

4146
Otherwise:
4247

4348
* Securely Download `get-pip.py
4449
<https://raw.github.com/pypa/pip/master/contrib/get-pip.py>`_ [1]_
4550

46-
* Run ``python get-pip.py``. This will install or upgrade pip.
47-
Additionally, it will install setuptools if it's not installed already. To
48-
upgrade an existing setuptools, run ``pip install -U setuptools`` [2]_
51+
* Run ``python get-pip.py``. [2]_ This will install or upgrade pip.
52+
Additionally, it will install :ref:`setuptools` and :ref:`wheel` if they're
53+
not installed already.
54+
55+
.. warning::
56+
57+
Be cautious if you're using a Python install that's managed by your
58+
operating system or another package manager. get-pip.py does not
59+
coordinate with those tools, and may leave your system in an
60+
inconsistent state.
61+
4962

5063
2. Optionally, Create a virtual environment (See :ref:`section below <Creating
5164
and using Virtual Environments>` for details):
@@ -58,7 +71,7 @@ packages.
5871
virtualenv <DIR>
5972
source <DIR>/bin/activate
6073

61-
Using `pyvenv`_: [4]_
74+
Using `pyvenv`_: [3]_
6275

6376
::
6477

@@ -169,7 +182,7 @@ To install greater than or equal to one version and less than another:
169182

170183
To install a version that's `"compatible"
171184
<https://www.python.org/dev/peps/pep-0440/#compatible-release>`_ with a certain
172-
version: [5]_
185+
version: [4]_
173186

174187
::
175188

@@ -179,46 +192,32 @@ In this case, this means to install any version "==1.4.*" version that's also
179192
">=1.4.2".
180193

181194

182-
Upgrading packages
183-
==================
184-
185-
Upgrade an already installed `SomeProject` to the latest from PyPI.
186-
187-
::
188-
189-
pip install --upgrade SomeProject
190-
191-
192-
Installing Cached Wheels
193-
========================
195+
Source Distributions vs Wheels
196+
==============================
194197

195-
:term:`Wheel` is a pre-built :term:`distribution <Distribution Package>` format that
196-
provides faster installation compared to :term:`Source Distributions (sdist)
197-
<Source Distribution (or "sdist")>`, especially when a project contains compiled
198-
extensions.
198+
:ref:`pip` can install from either :term:`Source Distributions (sdist) <Source
199+
Distribution (or "sdist")>` or :term:`Wheels <Wheel>`, but if both are present
200+
on PyPI, pip will prefer a compatible :term:`wheel <Wheel>`.
199201

200-
As of v1.5, :ref:`pip` prefers :term:`wheels <Wheel>` over :term:`sdists <Source
201-
Distribution (or "sdist")>` when searching indexes.
202+
:term:`Wheels <Wheel>` are a pre-built :term:`distribution <Distribution
203+
Package>` format that provides faster installation compared to :term:`Source
204+
Distributions (sdist) <Source Distribution (or "sdist")>`, especially when a
205+
project contains compiled extensions.
202206

203-
Although wheels are `becoming more common <http://pythonwheels.com>`_ on
204-
:term:`PyPI <Python Package Index (PyPI)>`, if you want all of your dependencies
205-
converted to wheel, do the following (assuming you're using a :ref:`Requirements
206-
File <pip:Requirements Files>`):
207+
If :ref:`pip` does not find a wheel to install, it will locally build a wheel
208+
and cache it for future installs, instead of rebuilding the source distribution
209+
in the future.
207210

208-
::
209211

210-
pip wheel --wheel-dir=/local/wheels -r requirements.txt
212+
Upgrading packages
213+
==================
211214

212-
And then to install those requirements just using your local directory of wheels
213-
(and not from PyPI):
215+
Upgrade an already installed `SomeProject` to the latest from PyPI.
214216

215217
::
216218

217-
pip install --no-index --find-links=/local/wheels -r requirements.txt
218-
219+
pip install --upgrade SomeProject
219220

220-
:term:`Wheel` is intended to replace :term:`Eggs <Egg>`. For a detailed
221-
comparison, see :ref:`Wheel vs Egg`.
222221

223222

224223
Installing to the User Site
@@ -358,18 +357,12 @@ Install `setuptools extras`_.
358357
installs the default behavior
359358
<https://github.com/pypa/pip/issues/1668>`_.
360359
361-
.. [3] On Linux and OSX, pip and setuptools will usually be available for the system
362-
python from a system package manager (e.g. `yum` or `apt-get` for linux,
363-
or `homebrew` for OSX). Unfortunately, there is often delay in getting
364-
the latest version this way, so in most cases, you'll want to use these
365-
instructions.
366-
367-
.. [4] Beginning with Python 3.4, ``pyvenv`` (a stdlib alternative to
360+
.. [3] Beginning with Python 3.4, ``pyvenv`` (a stdlib alternative to
368361
:ref:`virtualenv`) will create virtualenv environments with ``pip``
369362
pre-installed, thereby making it an equal alternative to
370363
:ref:`virtualenv`.
371364
372-
.. [5] The compatible release specifier was accepted in :ref:`PEP440
365+
.. [4] The compatible release specifier was accepted in :ref:`PEP440
373366
<pypa:PEP440s>` and support was released in :ref:`setuptools` v8.0 and
374367
:ref:`pip` v6.0
375368

0 commit comments

Comments
 (0)