130620b6fa08f358738dea139367ec102c9791fb
[sdc/sdc-distribution-client.git] /
1 ===============================
2 Installing and Using Setuptools
3 ===============================
4
5 .. contents:: **Table of Contents**
6
7
8 `Change History <https://pythonhosted.org/setuptools/history.html>`_.
9
10 -------------------------
11 Installation Instructions
12 -------------------------
13
14 The recommended way to bootstrap setuptools on any system is to download
15 `ez_setup.py`_ and run it using the target Python environment. Different
16 operating systems have different recommended techniques to accomplish this
17 basic routine, so below are some examples to get you started.
18
19 Setuptools requires Python 2.6 or later. To install setuptools
20 on Python 2.4 or Python 2.5, use the `bootstrap script for Setuptools 1.x
21 <https://bitbucket.org/pypa/setuptools/raw/bootstrap-py24/ez_setup.py>`_.
22
23 The link provided to ez_setup.py is a bookmark to bootstrap script for the
24 latest known stable release.
25
26 .. _ez_setup.py: https://bootstrap.pypa.io/ez_setup.py
27
28 Windows (Powershell 3 or later)
29 ===============================
30
31 For best results, uninstall previous versions FIRST (see `Uninstalling`_).
32
33 Using Windows 8 (which includes PowerShell 3) or earlier versions of Windows
34 with PowerShell 3 installed, it's possible to install with one simple
35 Powershell command. Start up Powershell and paste this command::
36
37     > (Invoke-WebRequest https://bootstrap.pypa.io/ez_setup.py).Content | python -
38
39 You must start the Powershell with Administrative privileges or you may choose
40 to install a user-local installation::
41
42     > (Invoke-WebRequest https://bootstrap.pypa.io/ez_setup.py).Content | python - --user
43
44 If you have Python 3.3 or later, you can use the ``py`` command to install to
45 different Python versions. For example, to install to Python 3.3 if you have
46 Python 2.7 installed::
47
48     > (Invoke-WebRequest https://bootstrap.pypa.io/ez_setup.py).Content | py -3 -
49
50 The recommended way to install setuptools on Windows is to download
51 `ez_setup.py`_ and run it. The script will download the appropriate
52 distribution file and install it for you.
53
54 Once installation is complete, you will find an ``easy_install`` program in
55 your Python ``Scripts`` subdirectory.  For simple invocation and best results,
56 add this directory to your ``PATH`` environment variable, if it is not already
57 present. If you did a user-local install, the ``Scripts`` subdirectory is
58 ``$env:APPDATA\Python\Scripts``.
59
60
61 Windows (simplified)
62 ====================
63
64 For Windows without PowerShell 3 or for installation without a command-line,
65 download `ez_setup.py`_ using your preferred web browser or other technique
66 and "run" that file.
67
68
69 Unix (wget)
70 ===========
71
72 Most Linux distributions come with wget.
73
74 Download `ez_setup.py`_ and run it using the target Python version. The script
75 will download the appropriate version and install it for you::
76
77     > wget https://bootstrap.pypa.io/ez_setup.py -O - | python
78
79 Note that you will may need to invoke the command with superuser privileges to
80 install to the system Python::
81
82     > wget https://bootstrap.pypa.io/ez_setup.py -O - | sudo python
83
84 Alternatively, Setuptools may be installed to a user-local path::
85
86     > wget https://bootstrap.pypa.io/ez_setup.py -O - | python - --user
87
88 Note that on some older systems (noted on Debian 6 and CentOS 5 installations),
89 `wget` may refuse to download `ez_setup.py`, complaining that the certificate common name `*.c.ssl.fastly.net`
90 does not match the host name `bootstrap.pypa.io`. In addition, the `ez_setup.py` script may then encounter similar problems using
91 `wget` internally to download `setuptools-x.y.zip`, complaining that the certificate common name of `www.python.org` does not match the
92 host name `pypi.python.org`. Those are known issues, related to a bug in the older versions of `wget`
93 (see `Issue 59 <https://bitbucket.org/pypa/pypi/issue/59#comment-5881915>`_). If you happen to encounter them,
94 install Setuptools as follows::
95
96     > wget --no-check-certificate https://bootstrap.pypa.io/ez_setup.py
97     > python ez_setup.py --insecure
98
99
100 Unix including Mac OS X (curl)
101 ==============================
102
103 If your system has curl installed, follow the ``wget`` instructions but
104 replace ``wget`` with ``curl`` and ``-O`` with ``-o``. For example::
105
106     > curl https://bootstrap.pypa.io/ez_setup.py -o - | python
107
108
109 Advanced Installation
110 =====================
111
112 For more advanced installation options, such as installing to custom
113 locations or prefixes, download and extract the source
114 tarball from `Setuptools on PyPI <https://pypi.python.org/pypi/setuptools>`_
115 and run setup.py with any supported distutils and Setuptools options.
116 For example::
117
118     setuptools-x.x$ python setup.py install --prefix=/opt/setuptools
119
120 Use ``--help`` to get a full options list, but we recommend consulting
121 the `EasyInstall manual`_ for detailed instructions, especially `the section
122 on custom installation locations`_.
123
124 .. _EasyInstall manual: https://pythonhosted.org/setuptools/EasyInstall
125 .. _the section on custom installation locations: https://pythonhosted.org/setuptools/EasyInstall#custom-installation-locations
126
127
128 Downloads
129 =========
130
131 All setuptools downloads can be found at `the project's home page in the Python
132 Package Index`_.  Scroll to the very bottom of the page to find the links.
133
134 .. _the project's home page in the Python Package Index: https://pypi.python.org/pypi/setuptools
135
136 In addition to the PyPI downloads, the development version of ``setuptools``
137 is available from the `Bitbucket repo`_, and in-development versions of the
138 `0.6 branch`_ are available as well.
139
140 .. _Bitbucket repo: https://bitbucket.org/pypa/setuptools/get/default.tar.gz#egg=setuptools-dev
141 .. _0.6 branch: http://svn.python.org/projects/sandbox/branches/setuptools-0.6/#egg=setuptools-dev06
142
143 Uninstalling
144 ============
145
146 On Windows, if Setuptools was installed using an ``.exe`` or ``.msi``
147 installer, simply use the uninstall feature of "Add/Remove Programs" in the
148 Control Panel.
149
150 Otherwise, to uninstall Setuptools or Distribute, regardless of the Python
151 version, delete all ``setuptools*`` and ``distribute*`` files and
152 directories from your system's ``site-packages`` directory
153 (and any other ``sys.path`` directories) FIRST.
154
155 If you are upgrading or otherwise plan to re-install Setuptools or Distribute,
156 nothing further needs to be done. If you want to completely remove Setuptools,
157 you may also want to remove the 'easy_install' and 'easy_install-x.x' scripts
158 and associated executables installed to the Python scripts directory.
159
160 --------------------------------
161 Using Setuptools and EasyInstall
162 --------------------------------
163
164 Here are some of the available manuals, tutorials, and other resources for
165 learning about Setuptools, Python Eggs, and EasyInstall:
166
167 * `The EasyInstall user's guide and reference manual`_
168 * `The setuptools Developer's Guide`_
169 * `The pkg_resources API reference`_
170 * `The Internal Structure of Python Eggs`_
171
172 Questions, comments, and bug reports should be directed to the `distutils-sig
173 mailing list`_.  If you have written (or know of) any tutorials, documentation,
174 plug-ins, or other resources for setuptools users, please let us know about
175 them there, so this reference list can be updated.  If you have working,
176 *tested* patches to correct problems or add features, you may submit them to
177 the `setuptools bug tracker`_.
178
179 .. _setuptools bug tracker: https://bitbucket.org/pypa/setuptools/issues
180 .. _The Internal Structure of Python Eggs: https://pythonhosted.org/setuptools/formats.html
181 .. _The setuptools Developer's Guide: https://pythonhosted.org/setuptools/setuptools.html
182 .. _The pkg_resources API reference: https://pythonhosted.org/setuptools/pkg_resources.html
183 .. _The EasyInstall user's guide and reference manual: https://pythonhosted.org/setuptools/easy_install.html
184 .. _distutils-sig mailing list: http://mail.python.org/pipermail/distutils-sig/
185
186
187 -------
188 Credits
189 -------
190
191 * The original design for the ``.egg`` format and the ``pkg_resources`` API was
192   co-created by Phillip Eby and Bob Ippolito.  Bob also implemented the first
193   version of ``pkg_resources``, and supplied the OS X operating system version
194   compatibility algorithm.
195
196 * Ian Bicking implemented many early "creature comfort" features of
197   easy_install, including support for downloading via Sourceforge and
198   Subversion repositories.  Ian's comments on the Web-SIG about WSGI
199   application deployment also inspired the concept of "entry points" in eggs,
200   and he has given talks at PyCon and elsewhere to inform and educate the
201   community about eggs and setuptools.
202
203 * Jim Fulton contributed time and effort to build automated tests of various
204   aspects of ``easy_install``, and supplied the doctests for the command-line
205   ``.exe`` wrappers on Windows.
206
207 * Phillip J. Eby is the seminal author of setuptools, and
208   first proposed the idea of an importable binary distribution format for
209   Python application plug-ins.
210
211 * Significant parts of the implementation of setuptools were funded by the Open
212   Source Applications Foundation, to provide a plug-in infrastructure for the
213   Chandler PIM application.  In addition, many OSAF staffers (such as Mike
214   "Code Bear" Taylor) contributed their time and stress as guinea pigs for the
215   use of eggs and setuptools, even before eggs were "cool".  (Thanks, guys!)
216
217 * Tarek Ziadé is the principal author of the Distribute fork, which
218   re-invigorated the community on the project, encouraged renewed innovation,
219   and addressed many defects.
220
221 * Since the merge with Distribute, Jason R. Coombs is the
222   maintainer of setuptools.  The project is maintained in coordination with
223   the Python Packaging Authority (PyPA) and the larger Python community.
224
225 .. _files:
226
227