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

ContextualVersionConflict: pytest 5.3.3 (…/.tox/…-xdist…/lib/python3.6/site-packages), Requirement.parse('pytest!=5.3.3,>=3.6'), {'pytest-django'} #1503

Closed
blueyed opened this issue Jan 17, 2020 · 2 comments
Labels
bug:normal affects many people or has quite an impact

Comments

@blueyed
Copy link

blueyed commented Jan 17, 2020

Trying to skip pytest 5.3.3 via:

     install_requires=[
-        'pytest>=3.6',
+        'pytest>=3.6, !=5.3.3',
         'pathlib2;python_version<"3.4"',
     ],

I see:

$ python -m tox
py36-dj20-postgres-xdist-coverage create: /home/travis/build/pytest-dev/pytest-django/.tox/py36-dj20-postgres-xdist-coverage
py36-dj20-postgres-xdist-coverage installdeps: Django>=2.0,<2.1, psycopg2-binary, coverage-enable-subprocess, pytest-xdist>=1.15
py36-dj20-postgres-xdist-coverage develop-inst: /home/travis/build/pytest-dev/pytest-django
ERROR: invocation failed (exit code 2), logfile: /home/travis/build/pytest-dev/pytest-django/.tox/py36-dj20-postgres-xdist-coverage/log/py36-dj20-postgres-xdist-coverage-2.log
================================== log start ===================================
Obtaining file:///home/travis/build/pytest-dev/pytest-django
ERROR: Exception:
Traceback (most recent call last):
  File "/home/travis/build/pytest-dev/pytest-django/.tox/py36-dj20-postgres-xdist-coverage/lib/python3.6/site-packages/pip/_internal/req/req_install.py", line 441, in check_if_exists
    self.satisfied_by = pkg_resources.get_distribution(str(no_marker))
  File "/home/travis/build/pytest-dev/pytest-django/.tox/py36-dj20-postgres-xdist-coverage/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 481, in get_distribution
    dist = get_provider(dist)
  File "/home/travis/build/pytest-dev/pytest-django/.tox/py36-dj20-postgres-xdist-coverage/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 357, in get_provider
    return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
  File "/home/travis/build/pytest-dev/pytest-django/.tox/py36-dj20-postgres-xdist-coverage/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 900, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/home/travis/build/pytest-dev/pytest-django/.tox/py36-dj20-postgres-xdist-coverage/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 791, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pip._vendor.pkg_resources.ContextualVersionConflict: (pytest 5.3.3 (/home/travis/build/pytest-dev/pytest-django/.tox/py36-dj20-postgres-xdist-coverage/lib/python3.6/site-packages), Requirement.parse('pytest!=5.3.3,>=3.6'), {'pytest-django'})
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/home/travis/build/pytest-dev/pytest-django/.tox/py36-dj20-postgres-xdist-coverage/lib/python3.6/site-packages/pip/_internal/cli/base_command.py", line 153, in _main
    status = self.run(options, args)
  File "/home/travis/build/pytest-dev/pytest-django/.tox/py36-dj20-postgres-xdist-coverage/lib/python3.6/site-packages/pip/_internal/commands/install.py", line 382, in run
    resolver.resolve(requirement_set)
  File "/home/travis/build/pytest-dev/pytest-django/.tox/py36-dj20-postgres-xdist-coverage/lib/python3.6/site-packages/pip/_internal/legacy_resolve.py", line 201, in resolve
    self._resolve_one(requirement_set, req)
  File "/home/travis/build/pytest-dev/pytest-django/.tox/py36-dj20-postgres-xdist-coverage/lib/python3.6/site-packages/pip/_internal/legacy_resolve.py", line 365, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "/home/travis/build/pytest-dev/pytest-django/.tox/py36-dj20-postgres-xdist-coverage/lib/python3.6/site-packages/pip/_internal/legacy_resolve.py", line 295, in _get_abstract_dist_for
    req, self.require_hashes, self.use_user_site, self.finder,
    req.check_if_exists(use_user_site)
  File "/home/travis/build/pytest-dev/pytest-django/.tox/py36-dj20-postgres-xdist-coverage/lib/python3.6/site-packages/pip/_internal/req/req_install.py", line 452, in check_if_exists
    self.req.name
  File "/home/travis/build/pytest-dev/pytest-django/.tox/py36-dj20-postgres-xdist-coverage/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 481, in get_distribution
    dist = get_provider(dist)
  File "/home/travis/build/pytest-dev/pytest-django/.tox/py36-dj20-postgres-xdist-coverage/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 357, in get_provider
    return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
  File "/home/travis/build/pytest-dev/pytest-django/.tox/py36-dj20-postgres-xdist-coverage/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 900, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/home/travis/build/pytest-dev/pytest-django/.tox/py36-dj20-postgres-xdist-coverage/lib/python3.6/site-packages/pip/_vendor/pkg_resources/__init__.py", line 791, in resolve
    raise VersionConflict(dist, req).with_context(dependent_req)
pip._vendor.pkg_resources.ContextualVersionConflict: (pytest 5.3.3 (/home/travis/build/pytest-dev/pytest-django/.tox/py36-dj20-postgres-xdist-coverage/lib/python3.6/site-packages), Requirement.parse('pytest!=5.3.3,>=3.6'), {'pytest-django'})
=================================== log end ====================================
___________________________________ summary ____________________________________
ERROR:   py36-dj20-postgres-xdist-coverage: InvocationError for command /home/travis/build/pytest-dev/pytest-django/.tox/py36-dj20-postgres-xdist-coverage/bin/python -m pip install --exists-action w -e '/home/travis/build/pytest-dev/pytest-django[testing]' (exited with code 2)
The command "python -m tox" exited with 1.

This happens for all factors using "xdist" only, but not with Python 2.7.
Builds: https://travis-ci.org/pytest-dev/pytest-django/builds/638643975
PR: pytest-dev/pytest-django#803

From a quick guess it looks like the "xdist" factor pulls in the latest pytest (5.3.3), which then is rejected via setup.py?

I cannot reproduce this locally.

@blueyed blueyed added the bug:normal affects many people or has quite an impact label Jan 17, 2020
@blueyed
Copy link
Author

blueyed commented Jan 17, 2020

Fix/workaround:

diff --git a/tox.ini b/tox.ini
index e1dcb5f..acb7480 100644
--- a/tox.ini
+++ b/tox.ini
@@ -32,6 +32,7 @@ deps =
     pytest41: pytest>=4.1,<4.2
     pytest41: attrs==17.4.0
     xdist: pytest-xdist>=1.15
+    xdist: pytest!=5.3.3

 setenv =
     PYTHONPATH = {toxinidir}:{env:PYTHONPATH:}

@asottile
Copy link
Contributor

duplicate of pypa/pip#988

@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

2 participants