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

Missing info for package conflict #5823

Open
boonware opened this issue Aug 4, 2023 · 15 comments
Open

Missing info for package conflict #5823

boonware opened this issue Aug 4, 2023 · 15 comments
Labels
ai-triaged Status: Awaiting Update ⏳ This issue requires more information before assistance can be provided.

Comments

@boonware
Copy link

boonware commented Aug 4, 2023

Issue description

When a dependency conflict occurs, on many occasions I see that there is not sufficient information to diagnose the conflict. This can sometimes occur when first installing a project, so I cannot run pipenv graph as no dependencies are installed (installation fails). For example, in the trace below we can see that pyspark==3.3.2 fails to install due to a conflict, but a conflict with what?

home$ pipenv install 'pyspark==3.3.2'
Loading .env environment variables...
Installing pyspark==3.3.2...
Resolving pyspark==3.3.2...
Adding pyspark to Pipfile's [packages] ...
✔ Installation Succeeded
Pipfile.lock (3ffa3e) out of date, updating to (2149eb)...
Locking [packages] dependencies...
Building requirements...
Resolving dependencies...
Resolving dependencies...
✘ Locking Failed!
⠏ Locking...
CRITICAL:pipenv.patched.pip._internal.resolution.resolvelib.factory:Cannot install -r /var/folders/ts/ypl0gvnn55z1y7gydrghpdxc0000gn/T/pipenv-2dq4knuw-requirements/pipenv-sdc6xfpf-constraints.txt (line 10), -r /var/folders/ts/ypl0gvnn55z1y7gydrghpdxc0000gn/T/pipenv-2dq4knuw-requirements/pipenv-sdc6xfpf-constraints.txt (line 12) and pyspark==3.3.2 because these package versions have conflicting dependencies.
[ResolutionFailure]:   File "/opt/homebrew/Cellar/pipenv/2023.7.23/libexec/lib/python3.11/site-packages/pipenv/resolver.py", line 704, in _main
[ResolutionFailure]:       resolve_packages(
[ResolutionFailure]:   File "/opt/homebrew/Cellar/pipenv/2023.7.23/libexec/lib/python3.11/site-packages/pipenv/resolver.py", line 662, in resolve_packages
[ResolutionFailure]:       results, resolver = resolve(
[ResolutionFailure]:       ^^^^^^^^
[ResolutionFailure]:   File "/opt/homebrew/Cellar/pipenv/2023.7.23/libexec/lib/python3.11/site-packages/pipenv/resolver.py", line 642, in resolve
[ResolutionFailure]:       return resolve_deps(
[ResolutionFailure]:       ^^^^^^^^^^^^^
[ResolutionFailure]:   File "/opt/homebrew/Cellar/pipenv/2023.7.23/libexec/lib/python3.11/site-packages/pipenv/utils/resolver.py", line 1167, in resolve_deps
[ResolutionFailure]:       results, hashes, markers_lookup, resolver, skipped = actually_resolve_deps(
[ResolutionFailure]:       ^^^^^^^^^^^^^^^^^^^^^^
[ResolutionFailure]:   File "/opt/homebrew/Cellar/pipenv/2023.7.23/libexec/lib/python3.11/site-packages/pipenv/utils/resolver.py", line 948, in actually_resolve_deps
[ResolutionFailure]:       resolver.resolve()
[ResolutionFailure]:   File "/opt/homebrew/Cellar/pipenv/2023.7.23/libexec/lib/python3.11/site-packages/pipenv/utils/resolver.py", line 690, in resolve
[ResolutionFailure]:       raise ResolutionFailure(message=str(e))
[pipenv.exceptions.ResolutionFailure]: Warning: 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: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts

Expected result

The logs will show why the conflict occurs, i.e. what packages are conflicting.

Details

pipenv, version 2023.7.23

@matteius
Copy link
Member

matteius commented Aug 5, 2023

@boonware Have you tried running with --verbose or -v option?

@matteius matteius added the Status: Awaiting Update ⏳ This issue requires more information before assistance can be provided. label Aug 12, 2023
@sdepablos
Copy link

Hi @matteius, I can confirm the same. I've reproduced it with a clean Docker machine with the following Pipfile

[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
dbt-core = "==1.6.0"
dbt-bigquery = "==1.6.0"
sqlfluff = "==2.2.1"
sqlfluff-templater-dbt = "==2.2.1"

[dev-packages]
data-diff = "==0.8.3"
dbt-osmosis = {version = "==0.11.23", extras = ["workbench"]}

[requires]
python_version = "3.11"

With pipenv 2023.07.23

> docker run --rm -it -v $(pwd):/app -w /app python:3.11-slim bash
> pip install pipenv==2023.07.23
> pipenv --version
pipenv, version 2023.7.23
> pipenv lock
Creating a virtualenv for this project...
Pipfile: /app/Pipfile
Using /usr/local/bin/python3 (3.11.4) to create virtualenv...
⠹ Creating virtual environment...created virtual environment CPython3.11.4.final.0-64 in 201ms
  creator CPython3Posix(dest=/root/.local/share/virtualenvs/app-4PlAip0Q, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/root/.local/share/virtualenv)
    added seed packages: pip==23.2.1, setuptools==68.0.0, wheel==0.41.1
  activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator

✔ Successfully created virtual environment!
Virtualenv location: /root/.local/share/virtualenvs/app-4PlAip0Q
Locking [packages] dependencies...
Building requirements...
Resolving dependencies...
Resolving dependencies...
✔ Success!
Locking [dev-packages] dependencies...
Building requirements...
Resolving dependencies...
Resolving dependencies...
✘ Locking Failed!
⠇ Locking...
CRITICAL:pipenv.patched.pip._internal.resolution.resolvelib.factory:Cannot install data-diff and dbt-osmosis because these package versions have conflicting dependencies.
[ResolutionFailure]:   File "/usr/local/lib/python3.11/site-packages/pipenv/resolver.py", line 704, in _main
[ResolutionFailure]:       resolve_packages(
[ResolutionFailure]:   File "/usr/local/lib/python3.11/site-packages/pipenv/resolver.py", line 662, in resolve_packages
[ResolutionFailure]:       results, resolver = resolve(
[ResolutionFailure]:       ^^^^^^^^
[ResolutionFailure]:   File "/usr/local/lib/python3.11/site-packages/pipenv/resolver.py", line 642, in resolve
[ResolutionFailure]:       return resolve_deps(
[ResolutionFailure]:       ^^^^^^^^^^^^^
[ResolutionFailure]:   File "/usr/local/lib/python3.11/site-packages/pipenv/utils/resolver.py", line 1167, in resolve_deps
[ResolutionFailure]:       results, hashes, markers_lookup, resolver, skipped = actually_resolve_deps(
[ResolutionFailure]:       ^^^^^^^^^^^^^^^^^^^^^^
[ResolutionFailure]:   File "/usr/local/lib/python3.11/site-packages/pipenv/utils/resolver.py", line 948, in actually_resolve_deps
[ResolutionFailure]:       resolver.resolve()
[ResolutionFailure]:   File "/usr/local/lib/python3.11/site-packages/pipenv/utils/resolver.py", line 690, in resolve
[ResolutionFailure]:       raise ResolutionFailure(message=str(e))
[pipenv.exceptions.ResolutionFailure]: Warning: 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: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts

Traceback (most recent call last):
  File "/usr/local/bin/pipenv", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/usr/local/lib/python3.11/site-packages/pipenv/vendor/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pipenv/cli/options.py", line 58, in main
    return super().main(*args, **kwargs, windows_expand_args=False)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pipenv/vendor/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pipenv/vendor/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pipenv/vendor/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pipenv/vendor/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pipenv/vendor/click/decorators.py", line 84, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pipenv/vendor/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pipenv/vendor/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pipenv/cli/command.py", line 364, in lock
    do_lock(
  File "/usr/local/lib/python3.11/site-packages/pipenv/routines/lock.py", line 65, in do_lock
    venv_resolve_deps(
  File "/usr/local/lib/python3.11/site-packages/pipenv/utils/resolver.py", line 1110, in venv_resolve_deps
    c = resolve(cmd, st, project=project)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pipenv/utils/resolver.py", line 985, in resolve
    raise RuntimeError("Failed to lock Pipfile.lock!")
RuntimeError: Failed to lock Pipfile.lock!

With pipenv 2023.07.11

> docker run --rm -it -v $(pwd):/app -w /app python:3.11-slim bash
> pip install pipenv==2023.07.11
> pipenv --version
pipenv, version 2023.7.11
> pipenv lock
Creating a virtualenv for this project...
Pipfile: /app/Pipfile
Using /usr/local/bin/python3 (3.11.4) to create virtualenv...
⠹ Creating virtual environment...created virtual environment CPython3.11.4.final.0-64 in 215ms
  creator CPython3Posix(dest=/root/.local/share/virtualenvs/app-4PlAip0Q, clear=False, no_vcs_ignore=False, global=False)
  seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/root/.local/share/virtualenv)
    added seed packages: pip==23.2.1, setuptools==68.0.0, wheel==0.41.1
  activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator

✔ Successfully created virtual environment!
Virtualenv location: /root/.local/share/virtualenvs/app-4PlAip0Q
Locking [packages] dependencies...
Building requirements...
Resolving dependencies...
✔ Success!
Locking [dev-packages] dependencies...
Building requirements...
Resolving dependencies...
⠋ Locking...CRITICAL:pipenv.patched.pip._internal.resolution.resolvelib.factory:Cannot install data-diff and dbt-osmosis because these package versions have conflicting dependencies.
✘ Locking Failed!
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/pipenv/patched/pip/_internal/resolution/resolvelib/resolver.py", line 92, in resolve
    result = self._result = resolver.resolve(
                            ^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pipenv/patched/pip/_vendor/resolvelib/resolvers.py", line 546, in resolve
    state = resolution.resolve(requirements, max_rounds=max_rounds)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pipenv/patched/pip/_vendor/resolvelib/resolvers.py", line 439, in resolve
    raise ResolutionImpossible(self.state.backtrack_causes)
pipenv.patched.pip._vendor.resolvelib.resolvers.ResolutionImpossible: [RequirementInformation(requirement=SpecifierRequirement('protobuf<4,>=3.12'), parent=LinkCandidate('https://files.pythonhosted.org/packages/ed/7c/04aafd3877ab37635b6dbbf72dc95264cd7679e9e9f08978437e7a597809/streamlit-1.20.0-py2.py3-none-any.whl (from https://pypi.org/simple/streamlit/) (requires-python:>=3.7, !=3.9.7)')), RequirementInformation(requirement=SpecifierRequirement('protobuf==4.24.0; python_version >= "3.7"'), parent=LinkCandidate('https://files.pythonhosted.org/packages/92/c0/0a2c4041a40b3ca1c47ec4dec4cbff0082f973292b80518db0a5bcdad03f/dbt_core-1.6.0-py3-none-any.whl (from https://pypi.org/simple/dbt-core/) (requires-python:>=3.8)'))]

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/pipenv/utils/resolver.py", line 709, in resolve
    results = resolver.resolve(self.constraints, check_supported_wheels=False)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pipenv/patched/pip/_internal/resolution/resolvelib/resolver.py", line 101, in resolve
    raise error from e
pipenv.patched.pip._internal.exceptions.DistributionNotFound: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/pipenv/utils/resolver.py", line 1082, in venv_resolve_deps
    results = resolve_packages(
              ^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pipenv/resolver.py", line 654, in resolve_packages
    results, resolver = resolve(
                        ^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pipenv/resolver.py", line 634, in resolve
    return resolve_deps(
           ^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pipenv/utils/resolver.py", line 1134, in resolve_deps
    results, hashes, markers_lookup, resolver, skipped = actually_resolve_deps(
                                                         ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pipenv/utils/resolver.py", line 969, in actually_resolve_deps
    resolver.resolve()
  File "/usr/local/lib/python3.11/site-packages/pipenv/utils/resolver.py", line 711, in resolve
    raise ResolutionFailure(message=str(e))
pipenv.exceptions.ResolutionFailure: ERROR: ResolutionImpossible: for help visit https://pip.pypa.io/en/latest/topics/dependency-resolution/#dealing-with-dependency-conflicts

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/pipenv", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/usr/local/lib/python3.11/site-packages/pipenv/vendor/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pipenv/cli/options.py", line 58, in main
    return super().main(*args, **kwargs, windows_expand_args=False)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pipenv/vendor/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pipenv/vendor/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pipenv/vendor/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pipenv/vendor/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pipenv/vendor/click/decorators.py", line 84, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pipenv/vendor/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pipenv/vendor/click/decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/pipenv/cli/command.py", line 364, in lock
    do_lock(
  File "/usr/local/lib/python3.11/site-packages/pipenv/routines/lock.py", line 65, in do_lock
    venv_resolve_deps(
  File "/usr/local/lib/python3.11/site-packages/pipenv/utils/resolver.py", line 1100, in venv_resolve_deps
    raise RuntimeError("There was a problem with locking.")
RuntimeError: There was a problem with locking.

As you can see, with 2023.07.11 we get

raise ResolutionImpossible(self.state.backtrack_causes)
pipenv.patched.pip._vendor.resolvelib.resolvers.ResolutionImpossible: [RequirementInformation(requirement=SpecifierRequirement('protobuf<4,>=3.12'), parent=LinkCandidate('https://files.pythonhosted.org/packages/ed/7c/04aafd3877ab37635b6dbbf72dc95264cd7679e9e9f08978437e7a597809/streamlit-1.20.0-py2.py3-none-any.whl (from https://pypi.org/simple/streamlit/) (requires-python:>=3.7, !=3.9.7)')), RequirementInformation(requirement=SpecifierRequirement('protobuf==4.24.0; python_version >= "3.7"'), parent=LinkCandidate('https://files.pythonhosted.org/packages/92/c0/0a2c4041a40b3ca1c47ec4dec4cbff0082f973292b80518db0a5bcdad03f/dbt_core-1.6.0-py3-none-any.whl (from https://pypi.org/simple/dbt-core/) (requires-python:>=3.8)'))]

but not with 2023.07.23. I've tried also with the --verbose option and with Python 3.8 instead of 3.11, with the same result.

@matteius
Copy link
Member

@boonware 2023.7.11 had an unintentional side effect where the resolver wasn't being run in the target python version. You can enable this "feature" in 2023.07.23 by setting env var: PIPENV_RESOLVER_PARENT_PYTHON = 1

I think the problem is the error logging in the sub-process doesn't make it to the parent process.

That being said, it maybe the same, but could you also check the behavior with: #5793

@boonware
Copy link
Author

@boonware Have you tried running with --verbose or -v option?

Yes, this does not show the conflict either.

@kalebmckale
Copy link
Contributor

I'll try out this option for my problem. It would be nice if the temporary file that is created and is referred to in the verbose error message as containing the conflicting package was somehow kept or had its contents logged on error, e.g. line 12 in /tmp/pipenv-<some-hash>/.../pipenv-constraints...txt.

@matteius
Copy link
Member

@kalebmckale I think its a great point of frustration for many users and we should aim to improve the inter-process communication so that the output generated by pip is not lost. Certainly there are some skilled python devs out there that can help once we merge the draft-no-reqslib branch. 🤞

I am about ready to merge that branch because at this point it fixes more issue reports than it causes, and I haven't heard any negative feedback about yet on something that hasn't been addressed or isn't already an issue. Having the resolver run in the parent process should yield more output, but just be aware if the parent python is a different version than the project python it may not be a consistent result.

@kalebmckale
Copy link
Contributor

Thanks for the word of caution. I will probably hold off until the next version instead.

@matteius
Copy link
Member

I pushed a change to the future looking pipenv branch which get the -v flag working with the pip resolver again in a more expected way: #5793

@kalebmckale
Copy link
Contributor

I will be able to test it at work tomorrow. I'm off today. Will let you know then.

@kalebmckale
Copy link
Contributor

Discussed on #5793 and verbose output has greatly improved.

@matteius
Copy link
Member

I believe the new release solves this.

@shayneoneill
Copy link

Whats in the new release that resolves it?. Still does this for me and I'm mystified as to what actually is the thing thats conflicting. Like, couldnt it just say "Hey this thing wants version x but that thing wants version y"?

@agalazis
Copy link

agalazis commented Sep 15, 2024

Not solved at all @matteius please reopen

@agalazis
Copy link

agalazis commented Sep 15, 2024

ok just figured out you can check the cause via --verbose. Maybe this could be included in some guide or catch the exception and expose the verbose mode message. Simplest solution: catch the error and instead of stack trace ask the user to rerun in verbose mode if not in verbose mode.

@matteius matteius reopened this Sep 15, 2024
@matteius
Copy link
Member

Analysis for Issue #5823:

Analysis of Pipenv Issue #5823: Missing info for package conflict

1. Main Problem

The issue reports that Pipenv sometimes fails to provide enough information about dependency conflicts during package resolution, especially when installing a new project. This makes it difficult for users to diagnose and resolve the conflict, as they are not told which packages are causing the issue.

2. Comments Discussion

  • User sdepablos provides a concrete example with a Pipfile that consistently produces this error.
  • Maintainer matteius suggests using the --verbose flag to get more information.
  • User boonware confirms that even with --verbose, the conflict information is still missing.
  • User kalebmckale requests that the temporary files (which contain the conflicting package information) should be either kept or logged.
  • Maintainer matteius explains that the problem is due to the resolver running in a subprocess, which causes its output not to be properly relayed back to the main process. They also mention a draft branch that aims to solve this by running the resolver in the parent process.
  • Maintainer matteius claims the issue is solved in a new release. However, user shayneoneill and agalazis disagree and request reopening the issue.
  • User agalazis clarifies that using --verbose does reveal the conflict information, but suggests improving the error message to guide users towards using --verbose.

3. Proposed Resolution

The root cause seems to be the lack of proper error handling and communication between the main Pipenv process and the subprocess running the resolver. This can be resolved by:

  1. Improving error reporting: Catch the ResolutionImpossible exception raised by the resolver subprocess and parse its "causes" attribute to extract the conflicting packages.
  2. Displaying conflict information in the error message: Include the names of the conflicting packages in the error message presented to the user.
  3. Guiding users towards using --verbose: If the conflict information is not available (e.g., due to a bug in the subprocess communication), the error message should explicitly advise users to try again with --verbose for more details.

4. Potential Code Changes

This snippet shows a potential way to implement the proposed changes, focusing on error handling:

# pipenv/utils/resolver.py - inside venv_resolve_deps() function
try:
results, hashes, internal_resolver = actually_resolve_deps(...)
except ResolutionFailure as e:
error_message = str(e)
# Try to extract conflict information from the exception.
try:
causes = e.__cause__.causes
conflicting_packages = [
cause.requirement.name for cause in causes
]
error_message += (
f"\nThe following packages have conflicting dependencies: "
f"{', '.join(conflicting_packages)}"
)
except AttributeError:
# Conflict information not available, advise using --verbose.
error_message += (
"\nPlease try again with the '--verbose' flag for more details."
)
raise ResolutionFailure(message=error_message)

5. Additional Steps

  • Thorough testing: The proposed changes need to be tested extensively with different scenarios and Pipfiles to ensure they correctly identify and display conflict information.
  • Consider PIPENV_RESOLVER_PARENT_PYTHON: Investigate if merging the draft branch mentioned by matteius (running the resolver in the parent process) would simplify error handling and provide more reliable conflict information.
  • Documentation: Update Pipenv documentation to clarify the use of --verbose and explain how to interpret the conflict information displayed in the error message.

By implementing these changes, Pipenv can become more user-friendly by providing clearer and more actionable information about dependency conflicts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ai-triaged Status: Awaiting Update ⏳ This issue requires more information before assistance can be provided.
Projects
None yet
Development

No branches or pull requests

6 participants