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

Output weird error message while having bad network issues #357

Closed
1 task done
linw1995 opened this issue Mar 30, 2021 · 2 comments
Closed
1 task done

Output weird error message while having bad network issues #357

linw1995 opened this issue Mar 30, 2021 · 2 comments
Labels
🐛 bug Something isn't working

Comments

@linw1995
Copy link
Member

  • I have searched the issue tracker and believe that this is not a duplicate.

Steps to reproduce

  1. set a wrong proxy configuration to simulate having a bad network issue.
  2. run pdm add or pdm lock
export https_proxy=http://127.0.0.1:1111 http_proxy=http://127.0.0.1:1111
pdm add cowsay -v

Actual behavior

Adding packages to default dependencies: cowsay
======== Start resolving requirements ========
	cowsay
	Adding requirement cowsay
🔒 Lock failed
Unable to find a resolution that satisfies the following requirements:
  cowsay (from project)
Please make sure the package names are correct. If so, you can either loosen the version constraints of these dependencies, or set a narrower `requires-python` range in the pyproject.toml.
Traceback (most recent call last):
  File "/Users/linw1995/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/resolver/core.py", line 23, in _merge_into_criterion
    crit = self.state.criteria[name]
KeyError: 'cowsay'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/linw1995/.local/pipx/venvs/pdm/lib/python3.9/site-packages/resolvelib/resolvers.py", line 318, in resolve
    name, crit = self._merge_into_criterion(r, parent=None)
  File "/Users/linw1995/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/resolver/core.py", line 25, in _merge_into_criterion
    crit = Criterion.from_requirement(self._p, requirement, parent)
  File "/Users/linw1995/.local/pipx/venvs/pdm/lib/python3.9/site-packages/resolvelib/resolvers.py", line 83, in from_requirement
    raise RequirementsConflicted(criterion)
resolvelib.resolvers.RequirementsConflicted: Requirements conflict: <NamedRequirement cowsay>

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/linw1995/.local/bin/pdm", line 8, in <module>
    sys.exit(main())
  File "/Users/linw1995/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/core.py", line 171, in main
    return Core().main(args)
  File "/Users/linw1995/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/core.py", line 133, in main
    raise err.with_traceback(traceback)
  File "/Users/linw1995/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/core.py", line 128, in main
    f(options.project, options)
  File "/Users/linw1995/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/cli/commands/add.py", line 35, in handle
    actions.do_add(
  File "/Users/linw1995/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/cli/actions.py", line 173, in do_add
    resolved = do_lock(project, strategy, tracked_names, reqs)
  File "/Users/linw1995/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/cli/actions.py", line 68, in do_lock
    mapping, dependencies, summaries = resolve(
  File "/Users/linw1995/.local/pipx/venvs/pdm/lib/python3.9/site-packages/pdm/resolver/core.py", line 152, in resolve
    result = resolver.resolve(requirements, max_rounds)
  File "/Users/linw1995/.local/pipx/venvs/pdm/lib/python3.9/site-packages/resolvelib/resolvers.py", line 453, in resolve
    state = resolution.resolve(requirements, max_rounds=max_rounds)
  File "/Users/linw1995/.local/pipx/venvs/pdm/lib/python3.9/site-packages/resolvelib/resolvers.py", line 320, in resolve
    raise ResolutionImpossible(e.criterion.information)
resolvelib.resolvers.ResolutionImpossible: [RequirementInformation(requirement=<NamedRequirement cowsay>, parent=None)]

Expected behavior

Maybe output a better error message to indicate network issues.

Environment Information

# Paste the output of `pdm info && pdm info --env` below:
PDM version:        1.4.5
Python Interpreter: /Users/linw1995/.pyenv/shims/python (2.7.17)
Project Root:       /private/tmp/pdm_test
{
  "os_name": "posix",
  "python_version": "2.7",
  "platform_system": "Darwin",
  "platform_release": "20.3.0",
  "implementation_version": "0",
  "python_full_version": "2.7.17",
  "implementation_name": "",
  "platform_python_implementation": "CPython",
  "platform_machine": "x86_64",
  "sys_platform": "darwin",
  "platform_version": "Darwin Kernel Version 20.3.0: Thu Jan 21 00:07:06 PST 2021; root:xnu-7195.81.3~1/RELEASE_X86_64"
}
@linw1995 linw1995 added the 🐛 bug Something isn't working label Mar 30, 2021
@frostming
Copy link
Collaborator

Unfortunately, the real ConnectionError is silenced by pip, so we can't get the exact reason, but to guess from the following 3 possibilities:

  1. The package doesn't exist on the PyPI
  2. The package index is invalid or down for some reason.
  3. Network condition problem.

Fixed on master

@linw1995
Copy link
Member Author

A more meaningful error message would be enough. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants