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

pdm lock & pdm install on git dependencies #1970

Closed
1 task done
martolini opened this issue Jun 2, 2023 · 3 comments · Fixed by #1976
Closed
1 task done

pdm lock & pdm install on git dependencies #1970

martolini opened this issue Jun 2, 2023 · 3 comments · Fixed by #1976
Assignees
Labels
🐛 bug Something isn't working

Comments

@martolini
Copy link

martolini commented Jun 2, 2023

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

Make sure you run commands with -v flag before pasting the output.

Steps to reproduce

  1. Create a clean folder
  2. pdm init -n
  3. echo git+https://github.com/online-ml/river > requirements.txt
  4. pdm import requirements.txt
  5. pdm lock
  6. pdm install <-- this fails.

However, pdm add git+https://github.com/online-ml/river works so there seems to be something weird with the flow.

Actual behavior

STATUS: Resolving packages from lockfile...
Traceback (most recent call last):
  File "/Users/martinroed/.local/bin/pdm", line 8, in <module>
    sys.exit(main())
  File "/Users/martinroed/.local/pipx/venvs/pdm/lib/python3.10/site-packages/pdm/core.py", line 255, in main
    return Core().main(args)
  File "/Users/martinroed/.local/pipx/venvs/pdm/lib/python3.10/site-packages/pdm/core.py", line 193, in main
    raise cast(Exception, err).with_traceback(traceback) from None
  File "/Users/martinroed/.local/pipx/venvs/pdm/lib/python3.10/site-packages/pdm/core.py", line 188, in main
    self.handle(project, options)
  File "/Users/martinroed/.local/pipx/venvs/pdm/lib/python3.10/site-packages/pdm/core.py", line 154, in handle
    command.handle(project, options)
  File "/Users/martinroed/.local/pipx/venvs/pdm/lib/python3.10/site-packages/pdm/cli/commands/install.py", line 62, in handle
    actions.do_sync(
  File "/Users/martinroed/.local/pipx/venvs/pdm/lib/python3.10/site-packages/pdm/cli/actions.py", line 197, in do_sync
    candidates = resolve_candidates_from_lockfile(project, requirements)
  File "/Users/martinroed/.local/pipx/venvs/pdm/lib/python3.10/site-packages/pdm/cli/actions.py", line 140, in resolve_candidates_from_lockfile
    mapping, *_ = resolve(
  File "/Users/martinroed/.local/pipx/venvs/pdm/lib/python3.10/site-packages/pdm/resolver/core.py", line 35, in resolve
    result = resolver.resolve(requirements, max_rounds)
  File "/Users/martinroed/.local/pipx/venvs/pdm/lib/python3.10/site-packages/resolvelib/resolvers.py", line 546, in resolve
    state = resolution.resolve(requirements, max_rounds=max_rounds)
  File "/Users/martinroed/.local/pipx/venvs/pdm/lib/python3.10/site-packages/resolvelib/resolvers.py", line 397, in resolve
    self._add_to_criteria(self.state.criteria, r, parent=None)
  File "/Users/martinroed/.local/pipx/venvs/pdm/lib/python3.10/site-packages/resolvelib/resolvers.py", line 173, in _add_to_criteria
    if not criterion.candidates:
  File "/Users/martinroed/.local/pipx/venvs/pdm/lib/python3.10/site-packages/resolvelib/structs.py", line 127, in __bool__
    next(iter(self))
  File "/Users/martinroed/.local/pipx/venvs/pdm/lib/python3.10/site-packages/pdm/resolver/providers.py", line 140, in <genexpr>
    return (
  File "/Users/martinroed/.local/pipx/venvs/pdm/lib/python3.10/site-packages/pdm/models/repositories.py", line 472, in find_candidates
    for key in self._matching_keys(requirement):
  File "/Users/martinroed/.local/pipx/venvs/pdm/lib/python3.10/site-packages/pdm/models/repositories.py", line 456, in _matching_keys
    if can_req.path != getattr(requirement, "path", None):  # type: ignore[attr-defined]
AttributeError: 'NamedRequirement' object has no attribute 'path'

Expected behavior

Install should work!

Environment Information

❯ pdm info && pdm info --env
PDM version:
  2.5.2
Python Interpreter:
  /Users/martinroed/play/debug-river/.venv/bin/python (3.11)
Project Root:
  /Users/martinroed/play/debug-river
Local Packages:


PDM 2.5.2 is installed, while 2.7.0 is available.
Please run `pdm self update` to upgrade.
Run `pdm config check_update false` to disable the check.
{
  "implementation_name": "cpython",
  "implementation_version": "3.11.3",
  "os_name": "posix",
  "platform_machine": "arm64",
  "platform_release": "22.2.0",
  "platform_system": "Darwin",
  "platform_version": "Darwin Kernel Version 22.2.0: Fri Nov 11 02:06:26 PST 2022;
root:xnu-8792.61.2~4/RELEASE_ARM64_T8112",
  "python_full_version": "3.11.3",
  "platform_python_implementation": "CPython",
  "python_version": "3.11",
  "sys_platform": "darwin"
}

PDM 2.5.2 is installed, while 2.7.0 is available.
Please run `pdm self update` to upgrade.
Run `pdm config check_update false` to disable the check.
@martolini martolini added the 🐛 bug Something isn't working label Jun 2, 2023
@pawamoy
Copy link
Sponsor Contributor

pawamoy commented Jun 2, 2023

What's the content of pyproject.toml after you imported from requirements.txt? Also, can you update PDM to latest version and confirm the issue still happens?

@martolini
Copy link
Author

Thanks for the quick response.

[tool.pdm]

[project]
name = ""
version = ""
description = ""
authors = [
    {name = "Martin Roed", email = "msroed@gmail.com"},
]
dependencies = ["git+https://github.com/online-ml/river"]
requires-python = ">=3.11"
license = {text = "MIT"}

[build-system]
requires = ["pdm-backend"]
build-backend = "pdm.backend"

I've tried it with a lot of different versions including 2.7.0. I've also tried it on a 3 different machines with the same results.

@frostming
Copy link
Collaborator

dependencies = ["git+https://github.com/online-ml/river"]

This should be fixed as river @ git+https://github.com/online-ml/river

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