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

Error when installing editable local dependency with eggs #1401

Closed
1 task done
nickchomey opened this issue Sep 26, 2022 · 2 comments · Fixed by #1403
Closed
1 task done

Error when installing editable local dependency with eggs #1401

nickchomey opened this issue Sep 26, 2022 · 2 comments · Fixed by #1403
Labels
🐛 bug Something isn't working

Comments

@nickchomey
Copy link

nickchomey commented Sep 26, 2022

  • 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

When I try to install a local package with editable mode AND an egg, I get an error [RequirementError]: The local path -e does not exist.

I can install without editable just fine. pdm add ./haystack[eggs]

Or I can install just the base package with editable with pdm add -e ./haystack --dev

But if I do pdm add -e ./haystack[eggs] --dev, I get the above error.

To reproduce

  1. create new directory and enter it
  2. pdm init with venv
  3. git clone https://github.com/deepset-ai/haystack.git
  4. pdm add -e ./haystack[ocr] --dev

pyproject.toml shows this in the dev section, but nothing is actually installed

dev = [
    "-e file:///${PROJECT_ROOT}/haystack#egg=farm-haystack[ocr]",
]

Environment Information

# Paste the output of `pdm info && pdm info --env` below:
PDM version:
  2.1.4
Python Interpreter:
  /home/nick/test1/.venv/bin/python (3.8)
Project Root:
  /home/nick/test1
Project Packages:
  None
{
  "implementation_name": "cpython",
  "implementation_version": "3.8.10",
  "os_name": "posix",
  "platform_machine": "x86_64",
  "platform_release": "5.15.62.1-microsoft-standard-WSL2",
  "platform_system": "Linux",
  "platform_version": "#1 SMP Wed Aug 24 22:24:20 UTC 2022",
  "python_full_version": "3.8.10",
  "platform_python_implementation": "CPython",
  "python_version": "3.8",
  "sys_platform": "linux"
}

Here is the debug log that comes from it

pdm.termui: Error occurs
Traceback (most recent call last):
  File "/home/nick/.local/share/pdm/venv/lib/python3.8/site-packages/packaging/requirements.py", line 102, in __init__
    req = REQUIREMENT.parseString(requirement_string)
  File "/home/nick/.local/share/pdm/venv/lib/python3.8/site-packages/pyparsing/core.py", line 1141, in parse_string
    raise exc.with_traceback(None)
pyparsing.exceptions.ParseException: Expected W:(0-9A-Za-z), found '-'  (at char 0), (line:1, col:1)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/nick/.local/share/pdm/venv/lib/python3.8/site-packages/pdm/models/requirements.py", line 459, in parse_requirement
    package_req = PackageRequirement(line)  # type: ignore
  File "/home/nick/.local/share/pdm/venv/lib/python3.8/site-packages/packaging/requirements.py", line 104, in __init__
    raise InvalidRequirement(
packaging.requirements.InvalidRequirement: Parse error at "'-e file:'": Expected W:(0-9A-Za-z)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/nick/.local/share/pdm/venv/lib/python3.8/site-packages/pdm/termui.py", line 234, in logging
    yield logger
  File "/home/nick/.local/share/pdm/venv/lib/python3.8/site-packages/pdm/cli/actions.py", line 145, in resolve_candidates_from_lockfile
    mapping, *_ = resolve(
  File "/home/nick/.local/share/pdm/venv/lib/python3.8/site-packages/pdm/resolver/core.py", line 30, in resolve
    result = resolver.resolve(requirements, max_rounds)
  File "/home/nick/.local/share/pdm/venv/lib/python3.8/site-packages/resolvelib/resolvers.py", line 481, in resolve
    state = resolution.resolve(requirements, max_rounds=max_rounds)
  File "/home/nick/.local/share/pdm/venv/lib/python3.8/site-packages/resolvelib/resolvers.py", line 373, in resolve
    failure_causes = self._attempt_to_pin_criterion(name)
  File "/home/nick/.local/share/pdm/venv/lib/python3.8/site-packages/resolvelib/resolvers.py", line 213, in _attempt_to_pin_criterion
    criteria = self._get_updated_criteria(candidate)
  File "/home/nick/.local/share/pdm/venv/lib/python3.8/site-packages/resolvelib/resolvers.py", line 203, in _get_updated_criteria
    for requirement in self._p.get_dependencies(candidate=candidate):
  File "/home/nick/.local/share/pdm/venv/lib/python3.8/site-packages/pdm/resolver/providers.py", line 187, in get_dependencies
    deps, requires_python, _ = self.repository.get_dependencies(candidate)
  File "/home/nick/.local/share/pdm/venv/lib/python3.8/site-packages/pdm/models/repositories.py", line 426, in get_dependencies
    reqs, python, summary = super().get_dependencies(candidate)
  File "/home/nick/.local/share/pdm/venv/lib/python3.8/site-packages/pdm/models/repositories.py", line 78, in get_dependencies
    reqs = [parse_requirement(line) for line in requirements]
  File "/home/nick/.local/share/pdm/venv/lib/python3.8/site-packages/pdm/models/repositories.py", line 78, in <listcomp>
    reqs = [parse_requirement(line) for line in requirements]
  File "/home/nick/.local/share/pdm/venv/lib/python3.8/site-packages/pdm/models/requirements.py", line 464, in parse_requirement
    r = FileRequirement.create(**m.groupdict())
  File "/home/nick/.local/share/pdm/venv/lib/python3.8/site-packages/pdm/models/requirements.py", line 264, in create
    return super().create(**kwargs)  # type: ignore
  File "/home/nick/.local/share/pdm/venv/lib/python3.8/site-packages/pdm/models/requirements.py", line 151, in create
    return cls(**kwargs)
  File "<string>", line 12, in __init__
  File "/home/nick/.local/share/pdm/venv/lib/python3.8/site-packages/pdm/models/requirements.py", line 253, in __post_init__
    raise RequirementError(f"The local path {self.path} does not exist.")
pdm.exceptions.RequirementError: The local path -e does not exist.

@nickchomey
Copy link
Author

nickchomey commented Sep 27, 2022

@frostming Thanks for fixing this so quickly! How do I install pdm with the latest version of the code from the repo? When I use the install script, it just installs 2.1.4 and I get the same error.

edit: I manually applied the changes from this fix, but it would still be great to know how to install the latest code without doing some sort of editable/dev install of pdm. Perhaps something could be added to the documentation?

@frostming
Copy link
Collaborator

frostming commented Sep 28, 2022

The install script accepts options, use the following to install the HEAD version:

curl -sSL https://raw.githubusercontent.com/pdm-project/pdm/main/install-pdm.py | python3 - --version head

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.

2 participants