Skip to content

new importlib-metadata release causes tox to break pip on Python<3.8 #1473

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

Closed
cjw296 opened this issue Dec 2, 2019 · 5 comments
Closed

new importlib-metadata release causes tox to break pip on Python<3.8 #1473

cjw296 opened this issue Dec 2, 2019 · 5 comments
Labels
bug:normal affects many people or has quite an impact

Comments

@cjw296
Copy link

cjw296 commented Dec 2, 2019

This line:
https://github.com/tox-dev/tox/blob/master/setup.cfg#L41

Causes pip to end up installing invalid dependencies and then barfing about them at runtime:

AssertionError: Traceback (most recent call last):
  File "setup.py", line 10, in <module>
    author_email='[email protected]',
  File "/data/jenkins/shiningpanda/jobs/7ec1442c/virtualenvs/d41d8cd9/lib/python3.6/site-packages/setuptools/__init__.py", line 145, in setup
    return distutils.core.setup(**attrs)
  File "/usr/lib64/python3.6/distutils/core.py", line 134, in setup
    ok = dist.parse_command_line()
  File "/data/jenkins/shiningpanda/jobs/7ec1442c/virtualenvs/d41d8cd9/lib/python3.6/site-packages/setuptools/dist.py", line 707, in parse_command_line
    result = _Distribution.parse_command_line(self)
  File "/usr/lib64/python3.6/distutils/dist.py", line 472, in parse_command_line
    args = self._parse_command_opts(parser, args)
  File "/data/jenkins/shiningpanda/jobs/7ec1442c/virtualenvs/d41d8cd9/lib/python3.6/site-packages/setuptools/dist.py", line 1014, in _parse_command_opts
    nargs = _Distribution._parse_command_opts(self, parser, args)
  File "/usr/lib64/python3.6/distutils/dist.py", line 528, in _parse_command_opts
    cmd_class = self.get_command_class(command)
  File "/data/jenkins/shiningpanda/jobs/7ec1442c/virtualenvs/d41d8cd9/lib/python3.6/site-packages/setuptools/dist.py", line 833, in get_command_class
    ep.require(installer=self.fetch_build_egg)
  File "/data/jenkins/shiningpanda/jobs/7ec1442c/virtualenvs/d41d8cd9/lib/python3.6/site-packages/pkg_resources/__init__.py", line 2465, in require
    items = working_set.resolve(reqs, env, installer, extras=self.extras)
  File "/data/jenkins/shiningpanda/jobs/7ec1442c/virtualenvs/d41d8cd9/lib/python3.6/site-packages/pkg_resources/__init__.py", line 791, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pkg_resources.ContextualVersionConflict: (importlib-metadata 1.1.0 (/data/jenkins/shiningpanda/jobs/7ec1442c/virtualenvs/d41d8cd9/lib/python3.6/site-packages), Requirement.parse('importlib-metadata<1,>=0.12; python_version < "3.8"'), {'tox'})

Honestly, this is arguably a pip bug, since 1.0.0 still meets the requirements, but it's likely more pragmatic to just change the requirement in your setup.cfg to be <2.0.

@cjw296 cjw296 added the bug:normal affects many people or has quite an impact label Dec 2, 2019
@gaborbernat
Copy link
Member

Closed via #1472

@StingyJack
Copy link

I had this error happen quite unexpectedly over the weekend, and spent sunday morning trying to fix it. I resolved it by adding 'importlib-metadata>=0.12,<1' to my setup.py file...

ERROR: tox 3.14.1 has requirement importlib-metadata<1,>=0.12; python_version < "3.8", but you'll have importlib-metadata 1.0.0 which is incompatible.

And now I've started receiving this error a few minutes ago...

ERROR: tox 3.14.2 has requirement importlib-metadata<2,>=1.1.0; python_version < "3.8", but you'll have importlib-metadata 0.23 which is incompatible.

I dont think its right to be using a patch-version increment when jumping a major version of a dependency like that. Time to lock tox on v3.14.1.

@vlizanae
Copy link

vlizanae commented Oct 4, 2020

I'm having a similar issue but now with importlib-metadata 2.0.0:

    ERROR: Command errored out with exit status 1:
     command: /home/vlizana/repos/vlizanae/pyntual/.tox/py36/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-req-build-o9i6ucw5/setup.py'"'"'; __file__='"'"'/tmp/pip-req-build-o9i6ucw5/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-lwgjlqw7
         cwd: /tmp/pip-req-build-o9i6ucw5/
    Complete output (13 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-req-build-o9i6ucw5/setup.py", line 52, in <module>
        zip_safe=False,
      File "/home/vlizana/repos/vlizanae/pyntual/.tox/py36/lib/python3.6/site-packages/setuptools/__init__.py", line 162, in setup
        _install_setup_requires(attrs)
      File "/home/vlizana/repos/vlizanae/pyntual/.tox/py36/lib/python3.6/site-packages/setuptools/__init__.py", line 157, in _install_setup_requires
        dist.fetch_build_eggs(dist.setup_requires)
      File "/home/vlizana/repos/vlizanae/pyntual/.tox/py36/lib/python3.6/site-packages/setuptools/dist.py", line 702, in fetch_build_eggs
        replace_conflicting=True,
      File "/home/vlizana/repos/vlizanae/pyntual/.tox/py36/lib/python3.6/site-packages/pkg_resources/__init__.py", line 790, in resolve
        raise VersionConflict(dist, req).with_context(dependent_req)
    pkg_resources.ContextualVersionConflict: (importlib-metadata 2.0.0 (/tmp/pip-req-build-o9i6ucw5/.eggs/importlib_metadata-2.0.0-py3.6.egg), Requirement.parse('importlib-metadata<2,>=0.12'), {'tox'})
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

@cjw296
Copy link
Author

cjw296 commented Oct 4, 2020

@StingyJack / @vlizanae - what's worked for me is using the new pip solver: pip install --use-feature=2020-resolver ..., hope it helps!

@StingyJack
Copy link

I just stopped using floating versions. This wasn't the only patch version break that burned me.

@tox-dev tox-dev locked and limited conversation to collaborators Jan 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug:normal affects many people or has quite an impact
Projects
None yet
Development

No branches or pull requests

4 participants