Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: <module 'setuptools.command.egg_info' from '/usr/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/command/egg_info.pyc'> has no 'write_setup_requirements' attribute #356

Closed
ghost opened this issue Mar 4, 2015 · 10 comments

Comments

@ghost
Copy link

ghost commented Mar 4, 2015

Originally reported by: bbbco (Bitbucket: bbbco, GitHub: bbbco)


We are using setuptools on several Jenkins jobs in our environment. Yesterday, jobs ran fine. Today, some of them are failing while installing setuptools on a Python 2.7 environment. It now throws this error:

#!python

[root@jenkins workspace]# virtualenv .
New python executable in ./bin/python2.7
Not overwriting existing python script ./bin/python (you must use ./bin/python2.7)
Installing setuptools...............................................
  Complete output from command /var/lib/jenkins/jobs/FFS-Scal...on2.7 -c "#!python
\"\"\"Bootstrap setuptoo...




" --always-copy -U setuptools:
  Searching for setuptools
Reading http://pypi.python.org/simple/setuptools/
Best match: setuptools 12.4
Downloading https://pypi.python.org/packages/source/s/setuptools/setuptools-12.4.zip#md5=b088ed7a43a93a1fd1fcabdf73bfa0bf
Processing setuptools-12.4.zip
Running setuptools-12.4/setup.py -q bdist_egg --dist-dir /tmp/easy_install-jZFvKz/setuptools-12.4/egg-dist-tmp-jyRZ8E
/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'src_root'
  warnings.warn(msg)
Traceback (most recent call last):
  File "<string>", line 278, in <module>
  File "<string>", line 239, in main
  File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 1712, in main
  File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 1700, in with_ei_usage
  File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 1716, in <lambda>
  File "/usr/lib/python2.7/distutils/core.py", line 152, in setup
    dist.run_commands()
  File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 211, in run
  File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 446, in easy_install
  File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 476, in install_item
  File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 655, in install_eggs
  File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 930, in build_and_install
  File "build/bdist.linux-i686/egg/setuptools/command/easy_install.py", line 919, in run_setup
  File "build/bdist.linux-i686/egg/setuptools/sandbox.py", line 62, in run_setup
  File "build/bdist.linux-i686/egg/setuptools/sandbox.py", line 105, in run
  File "build/bdist.linux-i686/egg/setuptools/sandbox.py", line 64, in <lambda>
  File "setup.py", line 186, in <module>
  File "/usr/lib/python2.7/distutils/core.py", line 152, in setup
    dist.run_commands()
  File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
    self.run_command(cmd)
  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "build/bdist.linux-i686/egg/setuptools/command/bdist_egg.py", line 167, in run
  File "/usr/lib/python2.7/distutils/cmd.py", line 326, in run_command
    self.distribution.run_command(command)
  File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
    cmd_obj.run()
  File "build/bdist.linux-i686/egg/setuptools/command/egg_info.py", line 169, in run
  File "build/bdist.linux-i686/egg/pkg_resources.py", line 1959, in load
ImportError: <module 'setuptools.command.egg_info' from '/usr/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg/setuptools/command/egg_info.pyc'> has no 'write_setup_requirements' attribute
----------------------------------------
...Installing setuptools...done.
Traceback (most recent call last):
  File "/usr/bin/virtualenv", line 8, in <module>
    load_entry_point('virtualenv==1.5.1', 'console_scripts', 'virtualenv')()
  File "/usr/lib/python2.7/site-packages/virtualenv-1.5.1-py2.7.egg/virtualenv.py", line 558, in main
    prompt=options.prompt)
  File "/usr/lib/python2.7/site-packages/virtualenv-1.5.1-py2.7.egg/virtualenv.py", line 654, in create_environment
    install_setuptools(py_executable, unzip=unzip_setuptools)
  File "/usr/lib/python2.7/site-packages/virtualenv-1.5.1-py2.7.egg/virtualenv.py", line 384, in install_setuptools
    _install_req(py_executable, unzip)
  File "/usr/lib/python2.7/site-packages/virtualenv-1.5.1-py2.7.egg/virtualenv.py", line 360, in _install_req
    cwd=cwd)
  File "/usr/lib/python2.7/site-packages/virtualenv-1.5.1-py2.7.egg/virtualenv.py", line 624, in call_subprocess
    % (cmd_desc, proc.returncode))
OSError: Command /var/lib/jenkins/jobs/FFS-Scal...on2.7 -c "#!python
\"\"\"Bootstrap setuptoo...




" --always-copy -U setuptools failed with error code 1

I have tracked it down to this recent commit. https://bitbucket.org/pypa/setuptools/commits/8bff4399a7af3d4d41d437248691f99818d1babd

This is an issue because we require the use of setuptools, but are not yet ready to upgrade python to python 3.


@ghost
Copy link
Author

ghost commented Mar 4, 2015

Original comment by bradchoate (Bitbucket: bradchoate, GitHub: bradchoate):


I came here to file this very ticket.

@ghost
Copy link
Author

ghost commented Mar 4, 2015

Original comment by jaraco (Bitbucket: jaraco, GitHub: jaraco):


The issue is unrelated to Python 3, but related to which version of setuptools is used to upgrade setuptools. I'm pretty sure I have environments that will encounter this error as well.

The underlying issue is that setuptools prior to 10.0 cannot upgrade to 12.4 or later. I failed to fully grasp this requirement, or I would have more carefully advertized the change and made the release more cautiously.

@richardipsum I'll probably have to back out this PR again, because there are a great number of setuptools environments that get created with old versions of setuptools (primarily by older versions of virtualenv).

I'd like to propose that clients devise a means to work around this issue, forcing upgrades of the underlying setuptools versions or requiring two-step upgrades (upgrade to 12.3 then to 12.4+), but I'm not sure what the implications of that would be.

@bradchoate, @bbbco Given this information, how much impact would it be to work around the issue until such a time that it's no longer relevant?

@ghost
Copy link
Author

ghost commented Mar 4, 2015

Original comment by zroadhouse-rmn (Bitbucket: zroadhouse-rmn, GitHub: Unknown):


+1 on backing out the PR. We have many systems where deployment (at the virtualenv step) is broken because of the 12.4 release.

Edit: upgrading virtualenv (pip install --upgrade virtualenv) fixes the problem on our older servers.

@ghost
Copy link
Author

ghost commented Mar 5, 2015

Original comment by bbbco (Bitbucket: bbbco, GitHub: bbbco):


Any advice on how to only use setuptools 12.3? The problem comes when activating virtualenv which always retrieves the latest version of setuptools. If we can pass an ENV or a parameter that will indicate only use 12.3 for now, that shouldn't be a problem.

@ghost
Copy link
Author

ghost commented Mar 5, 2015

Original comment by phaseburn (Bitbucket: phaseburn, GitHub: phaseburn):


I also ran into this problem. Jenkins + OSX 10.8 build slave + virtualenv caused this exact same issue for me.

I resolved it by upgrading setuptools manually via the ez_setup script, installing virtualenv again via that, and removing the old links to easy_install from the former version in /usr/bin (which OSX kindly put there from a very antiquated version), letting it fall back on the /usr/local/bin new ones. This should get people working again.

I will say that I also +1 backing out of the PR due to the manual intervention of things, as this was a major issue that it just arbitrarily stopped working. I'm going to have to manually review all my build slaves tomorrow to make sure they aren't going to run into this same issue in the event we utilize them with a python virtualenv job.

@ghost
Copy link
Author

ghost commented Mar 5, 2015

Original comment by samuk (Bitbucket: samuk, GitHub: samuk):


+1 on this issue. This has broken a lot of builds that use an older version of virtualenv, for me.

Edit: I should add. I've been able to update virtualenv as far as 1.10.1 which has resolved the issue for the time being.

Cheers

@ghost
Copy link
Author

ghost commented Mar 5, 2015

Original comment by lep (Bitbucket: lep, GitHub: lep):


FYI I had the same problem with a buildout, were an old bootstrap.py pulled setuptools 0.7.2 and then running bin/buildout, the update to 12.4 failed. Bumping bootstrap.py to the latest version (that pulls a recent setuptools to start with) fixed the problem for me. Thanks!

@ghost
Copy link
Author

ghost commented Mar 5, 2015

Original comment by katsuyan (Bitbucket: katsuyan, GitHub: Unknown):


+1

For now, I have fixed setuptools version to 12.3

If you are using the latest bootstrap.py, here is how I fixed it:

  • run pip install --upgrade setuptools==12.3 after virtualenv but before bootstrap.py.
  • insert following line before line 172 of bootstrap.py
#!python
setup_args['version'] = '12.3'

@ghost
Copy link
Author

ghost commented Mar 6, 2015

Original comment by jaraco (Bitbucket: jaraco, GitHub: jaraco):


Backed out changeset: 8bff4399a7af; Fixes #356

@ghost ghost added major bug labels Mar 29, 2016
@ghost ghost closed this as completed Mar 29, 2016
@Bra1nsen
Copy link

any updates?

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant