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.

poetry-core generates invalid PEP 508 requirements when extras are used

See original GitHub issue
  • I am on the latest stable Poetry version, installed using a recommended method.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have consulted the FAQ and blog for any relevant entries or release notes.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option) and have included the output below.

Issue

Installing the repository by poetry install works fine, but when running pip install . the following error message shows up:

Output message
Looking in indexes: https://pypi.org/simple, https://pypi.ngc.nvidia.com
Processing /home/luca/reposNuvi/test_monorepo/lib
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
ERROR: Exception:
Traceback (most recent call last):
  File "/home/luca/anaconda3/envs/split_na2/lib/python3.8/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3021, in _dep_map
    return self.__dep_map
  File "/home/luca/anaconda3/envs/split_na2/lib/python3.8/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2815, in __getattr__
    raise AttributeError(attr)
AttributeError: _DistInfoDistribution__dep_map

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/luca/anaconda3/envs/split_na2/lib/python3.8/site-packages/pip/_vendor/packaging/requirements.py", line 102, in __init__
    req = REQUIREMENT.parseString(requirement_string)
  File "/home/luca/anaconda3/envs/split_na2/lib/python3.8/site-packages/pip/_vendor/pyparsing/core.py", line 1141, in parse_string
    raise exc.with_traceback(None)
pip._vendor.pyparsing.exceptions.ParseException: Expected string_end, found 'extra'  (at char 11), (line:1, col:12)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/luca/anaconda3/envs/split_na2/lib/python3.8/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3101, in __init__
    super(Requirement, self).__init__(requirement_string)
  File "/home/luca/anaconda3/envs/split_na2/lib/python3.8/site-packages/pip/_vendor/packaging/requirements.py", line 104, in __init__
    raise InvalidRequirement(
pip._vendor.packaging.requirements.InvalidRequirement: Parse error at "'extra =='": Expected string_end

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/luca/anaconda3/envs/split_na2/lib/python3.8/site-packages/pip/_internal/cli/base_command.py", line 167, in exc_logging_wrapper
    status = run_func(*args)
  File "/home/luca/anaconda3/envs/split_na2/lib/python3.8/site-packages/pip/_internal/cli/req_command.py", line 247, in wrapper
    return func(self, options, args)
  File "/home/luca/anaconda3/envs/split_na2/lib/python3.8/site-packages/pip/_internal/commands/install.py", line 369, in run
    requirement_set = resolver.resolve(
  File "/home/luca/anaconda3/envs/split_na2/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/resolver.py", line 92, in resolve
    result = self._result = resolver.resolve(
  File "/home/luca/anaconda3/envs/split_na2/lib/python3.8/site-packages/pip/_vendor/resolvelib/resolvers.py", line 481, in resolve
    state = resolution.resolve(requirements, max_rounds=max_rounds)
  File "/home/luca/anaconda3/envs/split_na2/lib/python3.8/site-packages/pip/_vendor/resolvelib/resolvers.py", line 373, in resolve
    failure_causes = self._attempt_to_pin_criterion(name)
  File "/home/luca/anaconda3/envs/split_na2/lib/python3.8/site-packages/pip/_vendor/resolvelib/resolvers.py", line 213, in _attempt_to_pin_criterion
    criteria = self._get_updated_criteria(candidate)
  File "/home/luca/anaconda3/envs/split_na2/lib/python3.8/site-packages/pip/_vendor/resolvelib/resolvers.py", line 203, in _get_updated_criteria
    for requirement in self._p.get_dependencies(candidate=candidate):
  File "/home/luca/anaconda3/envs/split_na2/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/provider.py", line 237, in get_dependencies
    return [r for r in candidate.iter_dependencies(with_requires) if r is not None]
  File "/home/luca/anaconda3/envs/split_na2/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/provider.py", line 237, in <listcomp>
    return [r for r in candidate.iter_dependencies(with_requires) if r is not None]
  File "/home/luca/anaconda3/envs/split_na2/lib/python3.8/site-packages/pip/_internal/resolution/resolvelib/candidates.py", line 495, in iter_dependencies
    valid_extras = self.extras.intersection(self.base.dist.iter_provided_extras())
  File "/home/luca/anaconda3/envs/split_na2/lib/python3.8/site-packages/pip/_internal/metadata/pkg_resources.py", line 202, in iter_provided_extras
    return self._dist.extras
  File "/home/luca/anaconda3/envs/split_na2/lib/python3.8/site-packages/pip/_vendor/pkg_resources/__init__.py", line 2978, in extras
    return [dep for dep in self._dep_map if dep]
  File "/home/luca/anaconda3/envs/split_na2/lib/python3.8/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3023, in _dep_map
    self.__dep_map = self._compute_dependencies()
  File "/home/luca/anaconda3/envs/split_na2/lib/python3.8/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3033, in _compute_dependencies
    reqs.extend(parse_requirements(req))
  File "/home/luca/anaconda3/envs/split_na2/lib/python3.8/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3094, in parse_requirements
    yield Requirement(line)
  File "/home/luca/anaconda3/envs/split_na2/lib/python3.8/site-packages/pip/_vendor/pkg_resources/__init__.py", line 3103, in __init__
    raise RequirementParseError(str(e))
pip._vendor.pkg_resources.RequirementParseError: Parse error at "'extra =='": Expected string_end

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:11 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
neersightedcommented, Nov 7, 2022

Just note that by using a non-SHA git reference there is inherent instability; please do not release versions with such a build dependency (see #6741 for an example of why this is bad).

0reactions
luca-medeiroscommented, Nov 7, 2022

Thanks for the build-system trick! Seems to be working now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

History | Poetry - Python dependency management and ...
Fix an issue where invalid PEP 508 requirements were generated due to a missing space before semicolons (#510).
Read more >
poetry install different package version based on extras
When installing or specifying poetry-built packages, the extras defined in the toml file can be activated as described in PEP-508 definition ...
Read more >
PEP 621 – Storing project metadata in pyproject.toml
This PEP specifies how to write a project's core metadata in a pyproject.toml file for packaging-related tools to consume.
Read more >
Pipenv: A Guide to the New Python Packaging Tool
Pipenv is a packaging tool for Python that solves some common problems associated with the typical workflow using pip, virtualenv, and the good...
Read more >
Changelog - PDM
Fix a bug that requirement extras and underlying are resolved to the different version #1173; Update unearth to 0.4.1 to skip the wheels...
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