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

Adding a VCS dependency without explicit name leads to KeyError in v2.11.0 #2488

Closed
arxikv opened this issue Dec 14, 2023 · 3 comments · Fixed by j178/pdm#1
Closed

Adding a VCS dependency without explicit name leads to KeyError in v2.11.0 #2488

arxikv opened this issue Dec 14, 2023 · 3 comments · Fixed by j178/pdm#1
Labels
🐛 bug Something isn't working

Comments

@arxikv
Copy link

arxikv commented Dec 14, 2023

Hello,

I am trying to add this library as a VCS dependency to the blank project:

mkdir test-project && cd test-project
pdm init
pdm add "git+https://github.com/thunlp/OpenBackdoor.git"

In version 2.11.0, this fails with the following traceback:

pdm.termui: Error occurs
Traceback (most recent call last):
  File "/home/arkhipenko/.local/share/pdm/venv/lib/python3.11/site-packages/pdm/termui.py", line 246, in logging
    yield logger
  File "/home/arkhipenko/.local/share/pdm/venv/lib/python3.11/site-packages/pdm/cli/actions.py", line 103, in do_lock
    mapping, dependencies = resolve(
                            ^^^^^^^^
  File "/home/arkhipenko/.local/share/pdm/venv/lib/python3.11/site-packages/pdm/resolver/core.py", line 55, in resolve
    all_markers = merge_markers(result)
                  ^^^^^^^^^^^^^^^^^^^^^
  File "/home/arkhipenko/.local/share/pdm/venv/lib/python3.11/site-packages/pdm/resolver/graph.py", line 66, in merge_markers
    new_markers[k] = _build_marker(crit, all_markers, keep_unresolved)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/arkhipenko/.local/share/pdm/venv/lib/python3.11/site-packages/pdm/resolver/graph.py", line 107, in _build_marker
    parent_marker = resolved[_identify_parent(parent)]
                    ~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyError: 'openbackdoor'

Running pdm add "openbackdoor @ git+https://github.com/thunlp/OpenBackdoor.git" fixes the error.

However, according to the docs, PDM should be able to infer the dependency name automatically (and it worked in v2.10.4).

Thanks :)

@arxikv arxikv added the 🐛 bug Something isn't working label Dec 14, 2023
@elenakrittik
Copy link

elenakrittik commented Dec 27, 2023

Hello @frostming. If i understand correctly, the fix has made it into 2.11.1, but i still get this error when trying to pdm add git+https://github.com/DisnakeDev/disnake@f780cf5d7320210f022eba0d0e4e8b2820db2baa in an newly-initialized project using PDM 2.11.1.

Here are the logs:
log.txt

Should the issue be reopened or is this a problem on my end?

frostming added a commit that referenced this issue Dec 28, 2023
Resolve #2488

Signed-off-by: Frost Ming <me@frostming.com>
@elenakrittik
Copy link

Thank you.

@asuglia-alana
Copy link

asuglia-alana commented Jan 3, 2024

I just had the same error while trying to install a library from Github. I run pdm self update and now seems to be working!

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

Successfully merging a pull request may close this issue.

3 participants