jazzband / pip-tools

A set of tools to keep your pinned Python dependencies fresh.
https://pip-tools.rtfd.io
BSD 3-Clause "New" or "Revised" License
7.77k stars 611 forks source link

Error message human unreadable when using --resolver=backtracking #1821

Open mtesch-um opened 1 year ago

mtesch-um commented 1 year ago

What's the problem this feature will solve?

Using the new --resolver=backtracking causes completely unreadable error messages when resolution isnt possible.

Describe the solution you'd like

The old resolver's error messages were sufficient to explain to the user what was unresolvable, and legible for a human.

For an example, the new --resolver=backtracking (using pip-tools 6.12.3) gives:

Traceback (most recent call last):
  File "/Users/mtesch/src/ut_geotab/venv/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 92, in resolve
    result = self._result = resolver.resolve(
  File "/Users/mtesch/src/ut_geotab/venv/lib/python3.9/site-packages/pip/_vendor/resolvelib/resolvers.py", line 481, in resolve
    state = resolution.resolve(requirements, max_rounds=max_rounds)
  File "/Users/mtesch/src/ut_geotab/venv/lib/python3.9/site-packages/pip/_vendor/resolvelib/resolvers.py", line 385, in resolve
    raise ResolutionImpossible(self.state.backtrack_causes)
pip._vendor.resolvelib.resolvers.ResolutionImpossible: [RequirementInformation(requirement=SpecifierRequirement('attrs~=19.3'), parent=LinkCandidate('https://files.pythonhosted.org/packages/36/07/368cf47f06564d7ffff603ade4c60039ecf3f5b368b75201f4ccb5512d78/apache_airflow-1.10.12-py2.py3-none-any.whl (from https://pypi.org/simple/apache-airflow/) (requires-python:>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*)')), RequirementInformation(requirement=SpecifierRequirement('attrs>=17.3.0'), parent=LinkCandidate('https://files.pythonhosted.org/packages/dd/22/9b3e55dd0c8c460a9381c97e9f33cd4d7bc6f322f8c3ae5c9737becda9a3/aiohttp-3.8.1-cp39-cp39-macosx_10_9_x86_64.whl (from https://pypi.org/simple/aiohttp/) (requires-python:>=3.6)')), RequirementInformation(requirement=SpecifierRequirement('attrs>=20'), parent=LinkCandidate('https://files.pythonhosted.org/packages/b8/bb/0a4ae331fb64b0ccc6a83161d9aa462b2c38758823ac0ae48954714d5293/cattrs-1.10.0-py3-none-any.whl (from https://pypi.org/simple/cattrs/) (requires-python:>=3.7,<4.0)')), RequirementInformation(requirement=SpecifierRequirement('attrs~=19.3'), parent=LinkCandidate('https://files.pythonhosted.org/packages/36/07/368cf47f06564d7ffff603ade4c60039ecf3f5b368b75201f4ccb5512d78/apache_airflow-1.10.12-py2.py3-none-any.whl (from https://pypi.org/simple/apache-airflow/) (requires-python:>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*)')), RequirementInformation(requirement=SpecifierRequirement('attrs>=17.3.0'), parent=LinkCandidate('https://files.pythonhosted.org/packages/dd/22/9b3e55dd0c8c460a9381c97e9f33cd4d7bc6f322f8c3ae5c9737becda9a3/aiohttp-3.8.1-cp39-cp39-macosx_10_9_x86_64.whl (from https://pypi.org/simple/aiohttp/) (requires-python:>=3.6)')), RequirementInformation(requirement=SpecifierRequirement('attrs>=20'), parent=LinkCandidate('https://files.pythonhosted.org/packages/48/f9/4be3a1b2780ed0b916e61a95d0e2397600df770c66e95cf50a3548099c35/cattrs-1.9.0-py3-none-any.whl (from https://pypi.org/simple/cattrs/) (requires-python:>=3.7,<4.0)')), RequirementInformation(requirement=SpecifierRequirement('attrs~=19.3'), parent=LinkCandidate('https://files.pythonhosted.org/packages/36/07/368cf47f06564d7ffff603ade4c60039ecf3f5b368b75201f4ccb5512d78/apache_airflow-1.10.12-py2.py3-none-any.whl (from https://pypi.org/simple/apache-airflow/) (requires-python:>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*)')), RequirementInformation(requirement=SpecifierRequirement('attrs>=17.3.0'), parent=LinkCandidate('https://files.pythonhosted.org/packages/dd/22/9b3e55dd0c8c460a9381c97e9f33cd4d7bc6f322f8c3ae5c9737becda9a3/aiohttp-3.8.1-cp39-cp39-macosx_10_9_x86_64.whl (from https://pypi.org/simple/aiohttp/) (requires-python:>=3.6)')), RequirementInformation(requirement=SpecifierRequirement('attrs>=20'), parent=LinkCandidate('https://files.pythonhosted.org/packages/85/f4/56570f79c6bf44d3032c60e29c3786a00857ca4b68ba635300e7f4e5fbbc/cattrs-1.8.0-py3-none-any.whl (from https://pypi.org/simple/cattrs/) (requires-python:>=3.7,<4.0)')), RequirementInformation(requirement=SpecifierRequirement('attrs~=19.3'), parent=LinkCandidate('https://files.pythonhosted.org/packages/36/07/368cf47f06564d7ffff603ade4c60039ecf3f5b368b75201f4ccb5512d78/apache_airflow-1.10.12-py2.py3-none-any.whl (from https://pypi.org/simple/apache-airflow/) (requires-python:>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*)')), RequirementInformation(requirement=SpecifierRequirement('attrs>=17.3.0'), parent=LinkCandidate('https://files.pythonhosted.org/packages/dd/22/9b3e55dd0c8c460a9381c97e9f33cd4d7bc6f322f8c3ae5c9737becda9a3/aiohttp-3.8.1-cp39-cp39-macosx_10_9_x86_64.whl (from https://pypi.org/simple/aiohttp/) (requires-python:>=3.6)')), RequirementInformation(requirement=SpecifierRequirement('attrs>=20.1.0'), parent=LinkCandidate('https://files.pythonhosted.org/packages/fd/90/22ada6ed1e4db5c0e0dbb33688d22254201fa1218d2a5a5aacc553e2308e/cattrs-1.7.1-py3-none-any.whl (from https://pypi.org/simple/cattrs/) (requires-python:>=3.7,<4.0)')), RequirementInformation(requirement=SpecifierRequirement('attrs~=19.3'), parent=LinkCandidate('https://files.pythonhosted.org/packages/36/07/368cf47f06564d7ffff603ade4c60039ecf3f5b368b75201f4ccb5512d78/apache_airflow-1.10.12-py2.py3-none-any.whl (from https://pypi.org/simple/apache-airflow/) (requires-python:>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*)')), RequirementInformation(requirement=SpecifierRequirement('attrs>=17.3.0'), parent=LinkCandidate('https://files.pythonhosted.org/packages/dd/22/9b3e55dd0c8c460a9381c97e9f33cd4d7bc6f322f8c3ae5c9737becda9a3/aiohttp-3.8.1-cp39-cp39-macosx_10_9_x86_64.whl (from https://pypi.org/simple/aiohttp/) (requires-python:>=3.6)')), RequirementInformation(requirement=SpecifierRequirement('attrs>=20.1.0'), parent=LinkCandidate('https://files.pythonhosted.org/packages/24/cf/661553ab79f8afa97a2248590b3530c5f9a95401ea7e99bbfa46a8da2f7f/cattrs-1.7.0-py3-none-any.whl (from https://pypi.org/simple/cattrs/) (requires-python:>=3.7,<4.0)')), RequirementInformation(requirement=SpecifierRequirement('attrs~=19.3'), parent=LinkCandidate('https://files.pythonhosted.org/packages/36/07/368cf47f06564d7ffff603ade4c60039ecf3f5b368b75201f4ccb5512d78/apache_airflow-1.10.12-py2.py3-none-any.whl (from https://pypi.org/simple/apache-airflow/) (requires-python:>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*)')), RequirementInformation(requirement=SpecifierRequirement('attrs>=17.3.0'), parent=LinkCandidate('https://files.pythonhosted.org/packages/dd/22/9b3e55dd0c8c460a9381c97e9f33cd4d7bc6f322f8c3ae5c9737becda9a3/aiohttp-3.8.1-cp39-cp39-macosx_10_9_x86_64.whl (from https://pypi.org/simple/aiohttp/) (requires-python:>=3.6)')), RequirementInformation(requirement=SpecifierRequirement('attrs>=20.1.0'), parent=LinkCandidate('https://files.pythonhosted.org/packages/f1/3b/c4ef63b93f2b21e968c4ae5d9cf0bfa622f3663d66b4b0d9214feee49119/cattrs-1.5.0-py3-none-any.whl (from https://pypi.org/simple/cattrs/) (requires-python:~=3.7)')), RequirementInformation(requirement=SpecifierRequirement('attrs~=19.3'), parent=LinkCandidate('https://files.pythonhosted.org/packages/36/07/368cf47f06564d7ffff603ade4c60039ecf3f5b368b75201f4ccb5512d78/apache_airflow-1.10.12-py2.py3-none-any.whl (from https://pypi.org/simple/apache-airflow/) (requires-python:>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*)')), RequirementInformation(requirement=SpecifierRequirement('attrs>=17.3.0'), parent=LinkCandidate('https://files.pythonhosted.org/packages/dd/22/9b3e55dd0c8c460a9381c97e9f33cd4d7bc6f322f8c3ae5c9737becda9a3/aiohttp-3.8.1-cp39-cp39-macosx_10_9_x86_64.whl (from https://pypi.org/simple/aiohttp/) (requires-python:>=3.6)')), RequirementInformation(requirement=SpecifierRequirement('attrs>=20.1.0'), parent=LinkCandidate('https://files.pythonhosted.org/packages/34/5e/0c0ce9c0adbcf102c77c4d5089f43b3ecf4ae1e3929468c7215f5b3089a2/cattrs-1.4.0-py3-none-any.whl (from https://pypi.org/simple/cattrs/) (requires-python:~=3.7)')), RequirementInformation(requirement=SpecifierRequirement('attrs~=19.3'), parent=LinkCandidate('https://files.pythonhosted.org/packages/36/07/368cf47f06564d7ffff603ade4c60039ecf3f5b368b75201f4ccb5512d78/apache_airflow-1.10.12-py2.py3-none-any.whl (from https://pypi.org/simple/apache-airflow/) (requires-python:>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*)')), RequirementInformation(requirement=SpecifierRequirement('attrs>=17.3.0'), parent=LinkCandidate('https://files.pythonhosted.org/packages/dd/22/9b3e55dd0c8c460a9381c97e9f33cd4d7bc6f322f8c3ae5c9737becda9a3/aiohttp-3.8.1-cp39-cp39-macosx_10_9_x86_64.whl (from https://pypi.org/simple/aiohttp/) (requires-python:>=3.6)')), RequirementInformation(requirement=SpecifierRequirement('attrs>=20.1.0'), parent=LinkCandidate('https://files.pythonhosted.org/packages/12/a3/5ead84bc068fcc76f780f6d42da2ff39639442a5c283a2e1e00ab71d4570/cattrs-1.3.0-py3-none-any.whl (from https://pypi.org/simple/cattrs/) (requires-python:~=3.7)')), RequirementInformation(requirement=SpecifierRequirement('attrs~=19.3'), parent=LinkCandidate('https://files.pythonhosted.org/packages/36/07/368cf47f06564d7ffff603ade4c60039ecf3f5b368b75201f4ccb5512d78/apache_airflow-1.10.12-py2.py3-none-any.whl (from https://pypi.org/simple/apache-airflow/) (requires-python:>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*)')), RequirementInformation(requirement=SpecifierRequirement('attrs>=17.3.0'), parent=LinkCandidate('https://files.pythonhosted.org/packages/dd/22/9b3e55dd0c8c460a9381c97e9f33cd4d7bc6f322f8c3ae5c9737becda9a3/aiohttp-3.8.1-cp39-cp39-macosx_10_9_x86_64.whl (from https://pypi.org/simple/aiohttp/) (requires-python:>=3.6)')), RequirementInformation(requirement=SpecifierRequirement('attrs>=20.1.0'), parent=LinkCandidate('https://files.pythonhosted.org/packages/0f/d0/c3c223a190aea4cc58589e69b4c287c7de6e741d7b3be432e47e3a0d2ecc/cattrs-1.2.0-py3-none-any.whl (from https://pypi.org/simple/cattrs/) (requires-python:~=3.7)')), RequirementInformation(requirement=SpecifierRequirement('attrs~=19.3'), parent=LinkCandidate('https://files.pythonhosted.org/packages/36/07/368cf47f06564d7ffff603ade4c60039ecf3f5b368b75201f4ccb5512d78/apache_airflow-1.10.12-py2.py3-none-any.whl (from https://pypi.org/simple/apache-airflow/) (requires-python:>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*)')), RequirementInformation(requirement=SpecifierRequirement('attrs>=17.3.0'), parent=LinkCandidate('https://files.pythonhosted.org/packages/dd/22/9b3e55dd0c8c460a9381c97e9f33cd4d7bc6f322f8c3ae5c9737becda9a3/aiohttp-3.8.1-cp39-cp39-macosx_10_9_x86_64.whl (from https://pypi.org/simple/aiohttp/) (requires-python:>=3.6)')), RequirementInformation(requirement=SpecifierRequirement('attrs>=20.1.0'), parent=LinkCandidate('https://files.pythonhosted.org/packages/de/6c/7e372e2826df2dc798bf49c6ddfc60e3218456bef82df1a29b387bf607ba/cattrs-1.1.2-py3-none-any.whl (from https://pypi.org/simple/cattrs/) (requires-python:~=3.7)')), RequirementInformation(requirement=SpecifierRequirement('attrs~=19.3'), parent=LinkCandidate('https://files.pythonhosted.org/packages/36/07/368cf47f06564d7ffff603ade4c60039ecf3f5b368b75201f4ccb5512d78/apache_airflow-1.10.12-py2.py3-none-any.whl (from https://pypi.org/simple/apache-airflow/) (requires-python:>=2.7,!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*)')), RequirementInformation(requirement=SpecifierRequirement('attrs>=17.3.0'), parent=LinkCandidate('https://files.pythonhosted.org/packages/dd/22/9b3e55dd0c8c460a9381c97e9f33cd4d7bc6f322f8c3ae5c9737becda9a3/aiohttp-3.8.1-cp39-cp39-macosx_10_9_x86_64.whl (from https://pypi.org/simple/aiohttp/) (requires-python:>=3.6)')), RequirementInformation(requirement=SpecifierRequirement('attrs>=20.1.0'), parent=LinkCandidate('https://files.pythonhosted.org/packages/73/d3/6d09bc2e6b6169f2ff71645e28eeb51fb88be92a8b24dcd9f27e9cf7089a/cattrs-1.1.1-py3-none-any.whl (from https://pypi.org/simple/cattrs/) (requires-python:~=3.7)'))]

wherease the old resolver w/o --resolver=backtracking gives a readable explanation:

Using legacy resolver. Consider using backtracking resolver with `--resolver=backtracking`.
Could not find a version that matches attrs>=17.3.0,>=17.4.0,>=20,~=19.3 (from apache-airflow==1.10.12->-r requirements.in (line 1))
Tried: 15.0.0, 15.1.0, 15.1.0, 15.2.0, 15.2.0, 16.0.0, 16.0.0, 16.1.0, 16.1.0, 16.2.0, 16.2.0, 16.3.0, 16.3.0, 17.1.0, 17.1.0, 17.2.0, 17.2.0, 17.3.0, 17.3.0, 17.4.0, 17.4.0, 18.1.0, 18.1.0, 18.2.0, 18.2.0, 19.1.0, 19.1.0, 19.2.0, 19.2.0, 19.3.0, 19.3.0, 20.1.0, 20.1.0, 20.2.0, 20.2.0, 20.3.0, 20.3.0, 21.1.0, 21.1.0, 21.2.0, 21.2.0, 21.3.0, 21.3.0, 21.4.0, 21.4.0, 22.1.0, 22.1.0, 22.2.0, 22.2.0
Skipped pre-versions: 15.0.0a1
There are incompatible versions in the resolved dependencies:
  attrs>=20 (from cattrs==1.10.0->apache-airflow==1.10.12->-r requirements.in (line 1))
  attrs~=19.3 (from apache-airflow==1.10.12->-r requirements.in (line 1))
  attrs>=17.4.0 (from jsonschema==3.2.0->apache-airflow==1.10.12->-r requirements.in (line 1))
  attrs>=17.3.0 (from aiohttp==3.8.1->utilimarc-utils==2.24.0->-r requirements.in (line 13))

Alternative Solutions

dont use new resolver.

Additional context

atugushev commented 1 year ago

@mtesch-um

Thanks for the report! That's an error directly from pip. While we can this improve in pip-tools it's worth opening an issue on pip's tracker to improve UX there. What do you think?

tekumara commented 1 year ago

Related to pip #9036 - Show dependency tree in ResolutionImpossible error message

markfickett commented 6 months ago

And https://github.com/jazzband/pip-tools/issues/2072 .