pipenv icon indicating copy to clipboard operation
pipenv copied to clipboard

Regression updating dependencies in 2025.0.3 - ResolutionTooDeepError

Open ipmb opened this issue 6 months ago • 3 comments

Issue description

Updating dependencies fails with a ResolutionTooDeepError error

Expected result

It succeeds. Here is an example from the previous version: https://github.com/lincolnloop/python-package-manager-shootout/actions/runs/15331237636/job/43138278387

Actual result

To activate this project's virtualenv, run pipenv shell.
Alternatively, run a command inside the virtualenv with pipenv run.
Installing dependencies from Pipfile.lock (247cab)...
All dependencies are now up-to-date!
Upgrading  in  dependencies.
Building requirements...
Resolving dependencies...
Locking Failed!
Traceback (most recent call last):
  File "/home/runner/.local/lib/python3.11/site-packages/pipenv/resolver.py", 
line 465, in <module>
    main()
  File "/home/runner/.local/lib/python3.11/site-packages/pipenv/resolver.py", 
line 451, in main
    _main(
  File "/home/runner/.local/lib/python3.11/site-packages/pipenv/resolver.py", 
line 436, in _main
    resolve_packages(
  File "/home/runner/.local/lib/python3.11/site-packages/pipenv/resolver.py", 
line 400, in resolve_packages
    results, resolver = resolve_deps(
                        ^^^^^^^^^^^^^
  File 
"/home/runner/.local/lib/python3.11/site-packages/pipenv/utils/resolver.py", 
line 979, in resolve_deps
    results, hashes, internal_resolver = actually_resolve_deps(
                                         ^^^^^^^^^^^^^^^^^^^^^^
  File 
"/home/runner/.local/lib/python3.11/site-packages/pipenv/utils/resolver.py", 
line 747, in actually_resolve_deps
    resolver.resolve()
  File 
"/home/runner/.local/lib/python3.11/site-packages/pipenv/utils/resolver.py", 
line 472, in resolve
    results = resolver.resolve(self.constraints, check_supported_wheels=False)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File 
"/home/runner/.local/lib/python3.11/site-packages/pipenv/patched/pip/_internal/r
esolution/resolvelib/resolver.py", line 107, in resolve
    raise ResolutionTooDeepError from None
pipenv.patched.pip._internal.exceptions.ResolutionTooDeepError: 
<ResolutionTooDeepError: resolution-too-deep>

Your dependencies could not be resolved. You likely have a mismatch in your 
sub-dependencies.
You can use $ pipenv run pip install <requirement_name> to bypass this 
mechanism, then run $ pipenv graph to inspect the versions actually installed in
the virtualenv.
Hint: try $ pipenv lock --pre if it is a pre-release dependency.
ERROR: Failed to lock Pipfile.lock!

Steps to replicate

You can see the steps taken here, https://github.com/lincolnloop/python-package-manager-shootout/actions/runs/15347384043/job/43186661701

ipmb avatar May 30 '25 15:05 ipmb

@ipmb We are noticing similar errors but I narrowed it down to a google dependency we pull for our Airflow project on MWAA:

apache-airflow-providers-google = "==10.19.0"

Edit: I think it's due to a breaking change reported here: https://github.com/googleapis/python-spanner-sqlalchemy/issues/682

julio-tl avatar Jun 04 '25 19:06 julio-tl

pdm, uv, poetry, and pip-tools all handle this without an issue, so while it may be related to a package upstream, I'm not sure if the error here is correct.

ipmb avatar Jun 10 '25 15:06 ipmb

My best guess is the newer pip we vendor'd in which has a newer resolvelib might do more backtracking and this value may need to be increased and/or made configurable: https://github.com/pypa/pipenv/blob/3195260e230a7d89087a2b4f5a0f25be7f9f3191/pipenv/patched/pip/_internal/resolution/resolvelib/resolver.py#L95

matteius avatar Jun 10 '25 15:06 matteius

The latest resolvelib 1.2.0 that was released fixes the issue -- I dropped it ontop the pip _vendor directory, and tests + benchmark are passing in the PR https://github.com/pypa/pipenv/pull/6419

I am seeing if more can be done as well, but that seems to have been the cause (upgrading pip, which upgraded resolvelib to a version that could get in weird loop or similar).

matteius avatar Jun 26 '25 14:06 matteius

2025.0.4 has been released which addresses this issue.

matteius avatar Jul 07 '25 21:07 matteius