Skip to content

Commit 1e9202a

Browse files
committed
add cookbook entry for distribute to setuptools upgrade
1 parent cbfe4e0 commit 1e9202a

File tree

2 files changed

+77
-3
lines changed

2 files changed

+77
-3
lines changed

docs/cookbook.rst

+75-3
Original file line numberDiff line numberDiff line change
@@ -157,9 +157,6 @@ from http://python.org/. If you already upload other binary formats to
157157
pypi, upload wheels as well. Unlike the older formats, wheels are
158158
compatible with virtual environments.
159159

160-
.. _Setuptools: http://pypi.python.org/pypi/setuptools/
161-
.. _Distribute: http://pypi.python.org/pypi/distribute/
162-
163160

164161
.. _`Downloading Archives`:
165162

@@ -277,3 +274,78 @@ To have the dependency located from a local directory and not crawl PyPI, add th
277274
allow_hosts = ''
278275
find_links = file:///path/to/local/archives
279276

277+
278+
Upgrading from distribute to setuptools
279+
***************************************
280+
281+
`distribute`_ has now been merged into `setuptools`_, and it is recommended to upgrade to setuptools when possible.
282+
283+
To upgrade from `distribute`_ to `setuptools`_ using pip, run::
284+
285+
pip install --upgrade setuptools
286+
287+
"ImportError: No module named setuptools"
288+
-----------------------------------------
289+
290+
Although using the upgrade command above works in isolation, it's possible to get
291+
"ImportError: No module named setuptools" when using pip<1.4 to upgrade a
292+
package that depends on setuptools or distribute.
293+
294+
e.g. when running a command like this: `pip install --upgrade pyramid`
295+
296+
Solution
297+
~~~~~~~~
298+
299+
To prevent the problem in *new* environments (that aren't broken yet):
300+
301+
* Option 1:
302+
303+
* *First* run `pip install -U setuptools`,
304+
* *Then* run the command to upgrade your package (e.g. `pip install --upgrade pyramid`)
305+
306+
* Option 2:
307+
308+
* Upgrade pip using :ref:`get-pip <get-pip>`
309+
* *Then* run the command to upgrade your package (e.g. `pip install --upgrade pyramid`)
310+
311+
To fix the problem once it's occurred, you'll need to manually install the new
312+
setuptools, then rerun the upgrade that failed.
313+
314+
1. Download `ez_setup.py` (https://bitbucket.org/pypa/setuptools/downloads/ez_setup.py)
315+
2. Run `python ez_setup.py`
316+
3. Then rerun your upgrade (e.g. `pip install --upgrade pyramid`)
317+
318+
319+
Cause
320+
~~~~~
321+
322+
distribute-0.7.3 is just an empty wrapper that only serves to require the new
323+
setuptools (setuptools>=0.7) so that it will be installed. (if you don't know
324+
yet, the "new setuptools" is a merge of distribute and setuptools back into one
325+
project)
326+
327+
distribute-0.7.3 does it's job well, when the upgrade is done in isolation.
328+
E.g. if you're currently on distribute-0.6.X, then running `pip install -U
329+
setuptools` works fine to upgrade you to setuptools>=0.7.
330+
331+
The problem occurs when:
332+
333+
1. you are currently using an older distribute (i.e. 0.6.X)
334+
2. and you try to use pip to upgrade a package that *depends* on setuptools or
335+
distribute.
336+
337+
As part of the upgrade process, pip builds an install list that ends up
338+
including distribute-0.7.3 and setuptools>=0.7 , but they can end up being
339+
separated by other dependencies in the list, so what can happen is this:
340+
341+
1. pip uninstalls the existing distribute
342+
2. pip installs distribute-0.7.3 (which has no importable setuptools, that pip
343+
*needs* internally to function)
344+
3. pip moves onto install another dependency (before setuptools>=0.7) and is
345+
unable to proceed without the setuptools package
346+
347+
Note that pip v1.4 has fixes to prevent this. distribute-0.7.3 (or
348+
setuptools>=0.7) by themselves cannot prevent this kind of problem.
349+
350+
.. _setuptools: https://pypi.python.org/pypi/setuptools
351+
.. _distribute: https://pypi.python.org/pypi/distribute

docs/installing.rst

+2
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ installed.
8585
.. _distribute: https://pypi.python.org/pypi/distribute
8686

8787

88+
.. _`get-pip`:
89+
8890
Using get-pip
8991
+++++++++++++
9092

0 commit comments

Comments
 (0)