setuptools: AttributeError: Distribution instance has no attribute 'install_requires'

When downgrading setuptools 36.2.0 to 36.1.1 I get the above error. Here’s a log output:

2017-07-14 06:03:13.445605 | Installing collected packages: setuptools, pyldap, ldappool, pytz, Babel, MarkupSafe, Jinja2, olefile, Pillow, PyYAML, Pygments, alabaster, six, docutils, sphinx-rtd-theme, snowballstemmer, Sphinx, pbr, bashate, bottle, pycparser, cffi, chardet, coverage, ipaddress, pyasn1, enum34, idna, cryptography, restructuredtext-lint, stevedore, doc8, dulwich, funcsigs, mock, openstackdocstheme, requests, oslosphinx, paramiko, pycrypto, reno, sphinxmark, virtualenv, pyflakes, mccabe, pep8, flake8, hacking, ansible, ansible-lint
2017-07-14 06:03:13.445996 |   Found existing installation: setuptools 36.2.0
2017-07-14 06:03:13.486541 |     Uninstalling setuptools-36.2.0:
2017-07-14 06:03:13.504098 |       Successfully uninstalled setuptools-36.2.0
2017-07-14 06:03:13.510070 |   Rolling back uninstall of setuptools
2017-07-14 06:03:13.702180 | Exception:
2017-07-14 06:03:13.702251 | Traceback (most recent call last):
2017-07-14 06:03:13.702314 |   File "/home/jenkins/workspace/gate-openstack-ansible-linters-ubuntu-xenial/.tox/linters/local/lib/python2.7/site-packages/pip/basecommand.py", line 215, in main
2017-07-14 06:03:13.702339 |     status = self.run(options, args)
2017-07-14 06:03:13.702398 |   File "/home/jenkins/workspace/gate-openstack-ansible-linters-ubuntu-xenial/.tox/linters/local/lib/python2.7/site-packages/pip/commands/install.py", line 342, in run
2017-07-14 06:03:13.702421 |     prefix=options.prefix_path,
2017-07-14 06:03:13.702480 |   File "/home/jenkins/workspace/gate-openstack-ansible-linters-ubuntu-xenial/.tox/linters/local/lib/python2.7/site-packages/pip/req/req_set.py", line 784, in install
2017-07-14 06:03:13.702496 |     **kwargs
2017-07-14 06:03:13.702556 |   File "/home/jenkins/workspace/gate-openstack-ansible-linters-ubuntu-xenial/.tox/linters/local/lib/python2.7/site-packages/pip/req/req_install.py", line 851, in install
2017-07-14 06:03:13.702588 |     self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
2017-07-14 06:03:13.702650 |   File "/home/jenkins/workspace/gate-openstack-ansible-linters-ubuntu-xenial/.tox/linters/local/lib/python2.7/site-packages/pip/req/req_install.py", line 1064, in move_wheel_files
2017-07-14 06:03:13.702672 |     isolated=self.isolated,
2017-07-14 06:03:13.702732 |   File "/home/jenkins/workspace/gate-openstack-ansible-linters-ubuntu-xenial/.tox/linters/local/lib/python2.7/site-packages/pip/wheel.py", line 247, in move_wheel_files
2017-07-14 06:03:13.702750 |     prefix=prefix,
2017-07-14 06:03:13.702810 |   File "/home/jenkins/workspace/gate-openstack-ansible-linters-ubuntu-xenial/.tox/linters/local/lib/python2.7/site-packages/pip/locations.py", line 140, in distutils_scheme
2017-07-14 06:03:13.702833 |     d = Distribution(dist_args)
2017-07-14 06:03:13.702892 |   File "/home/jenkins/workspace/gate-openstack-ansible-linters-ubuntu-xenial/.tox/linters/local/lib/python2.7/site-packages/setuptools/dist.py", line 365, in __init__
2017-07-14 06:03:13.702913 |     self._finalize_requires()
2017-07-14 06:03:13.702974 |   File "/home/jenkins/workspace/gate-openstack-ansible-linters-ubuntu-xenial/.tox/linters/local/lib/python2.7/site-packages/setuptools/dist.py", line 372, in _finalize_requires
2017-07-14 06:03:13.702996 |     if not self.install_requires:
2017-07-14 06:03:13.703029 | AttributeError: Distribution instance has no attribute 'install_requires'

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 6
  • Comments: 15 (7 by maintainers)

Commits related to this issue

Most upvoted comments

This checks out. A minimum reproducible test case had a requirements.txt file of just setuptools==36.5.0 and pylint==1.7.2. Looks like pylint is compiling wrapt in the installation, which is sufficient to trigger this bug.

Added a new line to my .travis.yml file to pip install setuptools==36.5.0 before pip install -r requirements.txt solved the problem for me, just in case anyone else hits the same issue.

Is this issue supposed to be fixed? Still experiencing the error when building on Travis CI. Or is there something wrong on their side?

OK, I’ve confirmed that if doing both an install of something from a git source and downgrading setuptools at the same time causes the failure.

@mimischi, @marius92mc: there’s no way to know if you’re experiencing the same issue with the limited information you provide. As noted above, the problem should only occur when a package is built from source and setuptools is also downgraded/upgraded from 36.2.0 as part of the same pip install invocation. The workaround is to downgrade/update setuptools by itself from wheel.