How to solve pkg_resources.VersionConflict error during bin/python bootstrap.py -d
Asked Answered
H

2

40

I am tring to create a new plone environment using python plone-devstart.py tool. I got a bootstrap error. So i used a command bin/python bootstrap.py -d from my project directory. It(bin/python bootstrap.py -d command) worked fine before But now i got an error like

oomsys@oomsysmob-6:~/demobrun$ bin/python bootstrap.py -d
Downloading http://pypi.python.org/packages/source/d/distribute/distribute-  
0.6.49.tar.gz
Extracting in /tmp/tmpDqVwYA
Now working in /tmp/tmpDqVwYA/distribute-0.6.49
Building a Distribute egg in /tmp/tmpv4Bzyv
/tmp/tmpv4Bzyv/distribute-0.6.49-py2.7.egg
Traceback (most recent call last):
File "bootstrap.py", line 118, in <module>
ws.require('zc.buildout' + VERSION)
File "build/bdist.linux-i686/egg/pkg_resources.py", line 698, in require
File "build/bdist.linux-i686/egg/pkg_resources.py", line 600, in resolve
pkg_resources.VersionConflict: (setuptools 0.6c11 (/home/oomsys/demobrun  
/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg),    
Requirement.parse('setuptools>=0.7'))
Honeysuckle answered 11/7, 2013 at 7:1 Comment(0)
T
31

You have the distribute fork of setuptools installed in your site packages, but your bootstrap.py is trying to install buildout 2.2.0, which uses the new merged setuptools 0.7 or newer egg.

The distribute fork of setuptools was merged back into the setuptools project and the transition is causing some pain.

Your options are:

Tell bootstrap to use an earlier zc.buildout version

Run bootstrap.py with the -v option, forcing it to stick to a specific, earlier version:

 $ bin/python bootstrap.py -d -v 2.1.1

Version 2.1.1 of buildout will not upgrade itself to 2.2 or newer and works with your distribute-supplied setuptools egg.

Uninstall the old distribute egg

Manually delete all distribute*, pkg_resources.py* and setuptools* files from your site-packages directory:

$ rm -rf /home/oomsys/demobrun/lib/python2.7/site-packages/setuptools*
$ rm -rf /home/oomsys/demobrun/lib/python2.7/site-packages/distribute*
$ rm -rf /home/oomsys/demobrun/lib/python2.7/site-packages/pkg_resources.py*

and (optionally) reinstall setuptools from with the latest ez_setup.py; the current version is 0.9.6, and the setuptools PyPI page links you to this ez_setup.py version.

You'll also need to upgrade your bootstrap.py script, see below.

Use a recent virtualenv

Version 1.9 or newer of virtualenv (released March 2013) lets you create a virtualenv without the setuptools egg using the --no-setuptools switch:

$ virtualenv --no-setuptools buildout_env

Use that to create a virtual env python to run your bootstrap.py. You still need to upgrade your bootstrap.py too. See below.

Upgrade your bootstrap.py.

For zc.buildout versions 2.2.0 and up the bootstrap.py script has been updated to load setuptools the-not-forked-version. Grab a new copy at from github (link to the 2 branch version), replace your old bootstrap.py with it, and bootstrap again.

Do make sure you removed the old forked really-distribute-but-pretending-to-be-setuptools egg first or run with a virtual env python that does not have that egg. See above.

Tetter answered 11/7, 2013 at 8:1 Comment(2)
Thanks Martijn. What is your recommended option going forward?Tidewater
I've uninstalled distribute and use the newer setuptools everywhere, but I am currently in a position with almost no legacy projects (older code). Your situation may differ.Tetter
T
61

You could also try:

pip install --upgrade setuptools

as documented here https://askubuntu.com/questions/318824/how-to-solve-pkg-resources-versionconflict-error-during-bin-python-bootstrap-py/322701#322701

Twinge answered 30/9, 2013 at 19:53 Comment(3)
this did the trick for me, and was much faster then the suggestions above... needed a sudo in my caseWeese
This worked for me but did not need sudo as I was operating in a virtualenv.Hotel
error for me: `File "/usr/lib/python2.6/site-packages/pip/_internal/index.py", line 536 {str(c.version) for c in all_candidates}, ^ SyntaxError: invalid syntaxDispensable
T
31

You have the distribute fork of setuptools installed in your site packages, but your bootstrap.py is trying to install buildout 2.2.0, which uses the new merged setuptools 0.7 or newer egg.

The distribute fork of setuptools was merged back into the setuptools project and the transition is causing some pain.

Your options are:

Tell bootstrap to use an earlier zc.buildout version

Run bootstrap.py with the -v option, forcing it to stick to a specific, earlier version:

 $ bin/python bootstrap.py -d -v 2.1.1

Version 2.1.1 of buildout will not upgrade itself to 2.2 or newer and works with your distribute-supplied setuptools egg.

Uninstall the old distribute egg

Manually delete all distribute*, pkg_resources.py* and setuptools* files from your site-packages directory:

$ rm -rf /home/oomsys/demobrun/lib/python2.7/site-packages/setuptools*
$ rm -rf /home/oomsys/demobrun/lib/python2.7/site-packages/distribute*
$ rm -rf /home/oomsys/demobrun/lib/python2.7/site-packages/pkg_resources.py*

and (optionally) reinstall setuptools from with the latest ez_setup.py; the current version is 0.9.6, and the setuptools PyPI page links you to this ez_setup.py version.

You'll also need to upgrade your bootstrap.py script, see below.

Use a recent virtualenv

Version 1.9 or newer of virtualenv (released March 2013) lets you create a virtualenv without the setuptools egg using the --no-setuptools switch:

$ virtualenv --no-setuptools buildout_env

Use that to create a virtual env python to run your bootstrap.py. You still need to upgrade your bootstrap.py too. See below.

Upgrade your bootstrap.py.

For zc.buildout versions 2.2.0 and up the bootstrap.py script has been updated to load setuptools the-not-forked-version. Grab a new copy at from github (link to the 2 branch version), replace your old bootstrap.py with it, and bootstrap again.

Do make sure you removed the old forked really-distribute-but-pretending-to-be-setuptools egg first or run with a virtual env python that does not have that egg. See above.

Tetter answered 11/7, 2013 at 8:1 Comment(2)
Thanks Martijn. What is your recommended option going forward?Tidewater
I've uninstalled distribute and use the newer setuptools everywhere, but I am currently in a position with almost no legacy projects (older code). Your situation may differ.Tetter

© 2022 - 2024 — McMap. All rights reserved.