question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failed parsing requirement error for local dependency

See original GitHub issue

Release https://github.com/pypa/pipenv/releases/tag/v2022.8.24 introduces a bug about resolving local dependencies with a relative path.

Our setup has a local dependency described as {path = "./shared", extras = ["models", "auth0"]} in Pipfile.

pipenv install throws error: pipenv.vendor.requirementslib.exceptions.RequirementError: Failed parsing requirement from './shared#egg='

reverting to the previous release https://github.com/pypa/pipenv/releases/tag/v2022.8.19 fixes the issue for us.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:10

github_iconTop GitHub Comments

1reaction
mstdokumacicommented, Sep 2, 2022

I have already fixed the version to 2022.8.30 in all dockerfiles where we install pipenv. By the looks, #5320 seems to fix it. But it will be much easier for me to validate by the next release.

1reaction
matteiuscommented, Aug 29, 2022

@mstdokumaci I see what you mean about this example, it may be a new requirementslib issue–however, if you add editable = "true", to your local dependency it appears to work. Here was the stack trace I got without having editable = "true",

$ pipenv lock
Locking [packages] dependencies...
           Building requirements...
Traceback (most recent call last):
  File "C:\Users\matte\AppData\Roaming\Python\Python310\site-packages\pkg_resources\_vendor\packaging\requirements.py", line 102, in __init__
    req = REQUIREMENT.parseString(requirement_string)
  File "C:\Users\matte\AppData\Roaming\Python\Python310\site-packages\pkg_resources\_vendor\pyparsing\core.py", line 1141, in parse_string
    raise exc.with_traceback(None)
pkg_resources._vendor.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 "C:\Users\matte\Projects\pipenv\pipenv\vendor\requirementslib\models\requirements.py", line 966, in _parse_name_from_line
    self._requirement = init_requirement(self.line)
  File "C:\Users\matte\Projects\pipenv\pipenv\vendor\requirementslib\models\utils.py", line 194, in init_requirement
    req = Requirement.parse(name)
  File "C:\Users\matte\AppData\Roaming\Python\Python310\site-packages\pkg_resources\__init__.py", line 3147, in parse
    req, = parse_requirements(s)
  File "C:\Users\matte\AppData\Roaming\Python\Python310\site-packages\pkg_resources\__init__.py", line 3102, in __init__
    super(Requirement, self).__init__(requirement_string)
  File "C:\Users\matte\AppData\Roaming\Python\Python310\site-packages\pkg_resources\_vendor\packaging\requirements.py", line 104, in __init__
    raise InvalidRequirement(
pkg_resources.extern.packaging.requirements.InvalidRequirement: Parse error at "'./shared'": Expected W:(0-9A-Za-z)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1520.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1520.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\matte\AppData\Roaming\Python\Python310\Scripts\pipenv.exe\__main__.py", line 7, in <module>
  File "C:\Users\matte\Projects\pipenv\pipenv\vendor\click\core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "C:\Users\matte\Projects\pipenv\pipenv\cli\options.py", line 56, in main
    return super().main(*args, **kwargs, windows_expand_args=False)
  File "C:\Users\matte\Projects\pipenv\pipenv\vendor\click\core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "C:\Users\matte\Projects\pipenv\pipenv\vendor\click\core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "C:\Users\matte\Projects\pipenv\pipenv\vendor\click\core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Users\matte\Projects\pipenv\pipenv\vendor\click\core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "C:\Users\matte\Projects\pipenv\pipenv\vendor\click\decorators.py", line 84, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "C:\Users\matte\Projects\pipenv\pipenv\vendor\click\core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "C:\Users\matte\Projects\pipenv\pipenv\vendor\click\decorators.py", line 26, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "C:\Users\matte\Projects\pipenv\pipenv\cli\command.py", line 333, in lock
    do_lock(
  File "C:\Users\matte\Projects\pipenv\pipenv\core.py", line 1122, in do_lock
    venv_resolve_deps(
  File "C:\Users\matte\Projects\pipenv\pipenv\utils\resolver.py", line 1030, in venv_resolve_deps
    deps = convert_deps_to_pip(deps, project, include_index=True)
  File "C:\Users\matte\Projects\pipenv\pipenv\utils\dependencies.py", line 262, in convert_deps_to_pip
    req = new_dep.as_line(
  File "C:\Users\matte\Projects\pipenv\pipenv\vendor\requirementslib\models\requirements.py", line 2796, in as_line
    assert self.line_instance is not None
  File "C:\Users\matte\Projects\pipenv\pipenv\vendor\requirementslib\models\requirements.py", line 2554, in line_instance
    self.line_instance = self.get_line_instance()
  File "C:\Users\matte\Projects\pipenv\pipenv\vendor\requirementslib\models\requirements.py", line 2548, in get_line_instance
    return Line(line)
  File "C:\Users\matte\Projects\pipenv\pipenv\vendor\requirementslib\models\requirements.py", line 173, in __init__
    self.parse()
  File "C:\Users\matte\Projects\pipenv\pipenv\vendor\requirementslib\models\requirements.py", line 1304, in parse
    self.parse_name()
  File "C:\Users\matte\Projects\pipenv\pipenv\vendor\requirementslib\models\requirements.py", line 1027, in parse_name
    name = self._parse_name_from_line()
  File "C:\Users\matte\Projects\pipenv\pipenv\vendor\requirementslib\models\requirements.py", line 968, in _parse_name_from_line
    raise RequirementError(
pipenv.vendor.requirementslib.exceptions.RequirementError: Failed parsing requirement from './shared#egg='
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to fix locking failed in pipenv? - Stack Overflow
The error you get when you first run pipenv install with pipenv version 2020.8.13 . ... Requirement.parse('importlib-metadata<2,>=0.12; ...
Read more >
Dependency Scanning - GitLab Docs
If a non-fatal error is encountered, the analyzer falls back to parsing the available go.sum file. The process is repeated for every detected...
Read more >
pip install - pip documentation v22.3.1
python -m pip install [options] <requirement specifier> ... Local directory (which must contain a setup.py , or pip will report an error).
Read more >
Errors while running pip install -r requirements.txt - MongoDB
I am getting these kinds of error while running pip install -r ... errored out with exit status 1: command: 'c:\users\manan\appdata\local…
Read more >
Learning the Basics - Gradle User Manual
Before adding Maven local as a repository, you should make sure this is really required. To declare the local Maven cache as a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found