Reduce resolver rounds by an order of magnitude by pradyunsg · Pull Request #11908 · pypa/pip (original) (raw)
Does that mean if a user has a frozen set of requirements that needed no backtracking and they had 1 more requirement that max rounds it would fail?
Yup. Even equal to max rounds will fail, because it'll have a round of "I need nothing more".
❯ pip --version pip 23.1.dev0 from /Users/pradyunsg/Developer/github/pip/src/pip (python 3.11) ❯ g diff diff --git a/src/pip/_internal/resolution/resolvelib/resolver.py b/src/pip/_internal/resolution/resolvelib/resolver.py index 47bbfecce..ce92a5f6c 100644 --- a/src/pip/_internal/resolution/resolvelib/resolver.py +++ b/src/pip/_internal/resolution/resolvelib/resolver.py @@ -88,7 +88,7 @@ def resolve( )
try:
limit_how_complex_resolution_can_be = 200000
limit_how_complex_resolution_can_be = 2 result = self._result = resolver.resolve( collected.requirements, max_rounds=limit_how_complex_resolution_can_be )
❯ pip install sampleproject
Collecting sampleproject
Using cached sampleproject-3.0.0-py3-none-any.whl (4.7 kB)
Collecting peppercorn (from sampleproject)
Using cached peppercorn-0.6-py3-none-any.whl (4.8 kB)
ERROR: Exception:
Traceback (most recent call last):
File "/Users/pradyunsg/Developer/github/pip/src/pip/_internal/cli/base_command.py", line 160, in exc_logging_wrapper
status = run_func(*args)
^^^^^^^^^^^^^^^
File "/Users/pradyunsg/Developer/github/pip/src/pip/_internal/cli/req_command.py", line 248, in wrapper
return func(self, options, args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/pradyunsg/Developer/github/pip/src/pip/_internal/commands/install.py", line 398, in run
requirement_set = resolver.resolve(
^^^^^^^^^^^^^^^^^
File "/Users/pradyunsg/Developer/github/pip/src/pip/_internal/resolution/resolvelib/resolver.py", line 92, in resolve
result = self._result = resolver.resolve(
^^^^^^^^^^^^^^^^^
File "/Users/pradyunsg/Developer/github/pip/src/pip/_vendor/resolvelib/resolvers.py", line 546, in resolve
state = resolution.resolve(requirements, max_rounds=max_rounds)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/pradyunsg/Developer/github/pip/src/pip/_vendor/resolvelib/resolvers.py", line 457, in resolve
raise ResolutionTooDeep(max_rounds)
pip._vendor.resolvelib.resolvers.ResolutionTooDeep: 2
❯ pip install sampleproject==3.0.0 peppercorn==0.6
Collecting sampleproject==3.0.0
Using cached sampleproject-3.0.0-py3-none-any.whl (4.7 kB)
Collecting peppercorn==0.6
Using cached peppercorn-0.6-py3-none-any.whl (4.8 kB)
ERROR: Exception:
Traceback (most recent call last):
File "/Users/pradyunsg/Developer/github/pip/src/pip/_internal/cli/base_command.py", line 160, in exc_logging_wrapper
status = run_func(*args)
^^^^^^^^^^^^^^^
File "/Users/pradyunsg/Developer/github/pip/src/pip/_internal/cli/req_command.py", line 248, in wrapper
return func(self, options, args)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/pradyunsg/Developer/github/pip/src/pip/_internal/commands/install.py", line 398, in run
requirement_set = resolver.resolve(
^^^^^^^^^^^^^^^^^
File "/Users/pradyunsg/Developer/github/pip/src/pip/_internal/resolution/resolvelib/resolver.py", line 92, in resolve
result = self._result = resolver.resolve(
^^^^^^^^^^^^^^^^^
File "/Users/pradyunsg/Developer/github/pip/src/pip/_vendor/resolvelib/resolvers.py", line 546, in resolve
state = resolution.resolve(requirements, max_rounds=max_rounds)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/pradyunsg/Developer/github/pip/src/pip/_vendor/resolvelib/resolvers.py", line 457, in resolve
raise ResolutionTooDeep(max_rounds)
pip._vendor.resolvelib.resolvers.ResolutionTooDeep: 2
❯ pip install peppercorn==0.6
Collecting peppercorn==0.6
Using cached peppercorn-0.6-py3-none-any.whl (4.8 kB)
Installing collected packages: peppercorn
Successfully installed peppercorn-0.6