[InvalidRequirement] Invalid requirement, parse error at "'extra =='"
See original GitHub issue- I am on the latest Poetry version.
- I have searched the issues of this repo and believe that this is not a duplicate.
- If an exception occurs when executing a command, I executed it again in debug mode (
-vvv
option).
- OS version and name: maxOS 10.15
- Poetry version: 1.0.5
Issue
When I run:
poetry add git+https://github.com/huggingface/transformers.git#a21d4fa410dc3b4c62f93aa0e6bbe4b75a101ee9 -vvv
The following exception is thrown:
[InvalidRequirement]
Invalid requirement, parse error at "'extra =='"
Traceback (most recent call last):
File "/usr/local/Cellar/poetry/1.0.5_1/libexec/vendor/lib/python3.7/site-packages/clikit/console_application.py", line 131, in run
status_code = command.handle(parsed_args, io)
File "/usr/local/Cellar/poetry/1.0.5_1/libexec/vendor/lib/python3.7/site-packages/clikit/api/command/command.py", line 120, in handle
status_code = self._do_handle(args, io)
File "/usr/local/Cellar/poetry/1.0.5_1/libexec/vendor/lib/python3.7/site-packages/clikit/api/command/command.py", line 171, in _do_handle
return getattr(handler, handler_method)(args, io, self)
File "/usr/local/Cellar/poetry/1.0.5_1/libexec/vendor/lib/python3.7/site-packages/cleo/commands/command.py", line 92, in wrap_handle
return self.handle()
File "/usr/local/Cellar/poetry/1.0.5_1/libexec/lib/python3.7/site-packages/poetry/console/commands/add.py", line 89, in handle
packages, allow_prereleases=self.option('allow-prereleases')
File "/usr/local/Cellar/poetry/1.0.5_1/libexec/lib/python3.7/site-packages/poetry/console/commands/init.py", line 293, in _determine_requirements
requires = self._parse_requirements(requires)
File "/usr/local/Cellar/poetry/1.0.5_1/libexec/lib/python3.7/site-packages/poetry/console/commands/init.py", line 381, in _parse_requirements
"git", url.url, reference=pair.get("rev")
File "/usr/local/Cellar/poetry/1.0.5_1/libexec/lib/python3.7/site-packages/poetry/puzzle/provider.py", line 204, in get_package_from_vcs
package = cls.get_package_from_directory(tmp_dir, name=name)
File "/usr/local/Cellar/poetry/1.0.5_1/libexec/lib/python3.7/site-packages/poetry/puzzle/provider.py", line 412, in get_package_from_directory
dep = dependency_from_pep_508(req)
File "/usr/local/Cellar/poetry/1.0.5_1/libexec/lib/python3.7/site-packages/poetry/packages/__init__.py", line 39, in dependency_from_pep_508
req = Requirement(name)
File "/usr/local/Cellar/poetry/1.0.5_1/libexec/lib/python3.7/site-packages/poetry/version/requirements.py", line 212, in __init__
requirement_string[e.loc : e.loc + 8]
If I try to add the package manually to the pyproject.toml
file as follows:
transformers = {git = "https://github.com/huggingface/transformers.git", rev = "a21d4fa410dc3b4c62f93aa0e6bbe4b75a101ee9"}
The following exception is thrown instead:
[SolverProblemError]
Because text2error depends on transformers (*) which doesn't exist, version solving failed.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:14 (14 by maintainers)
Top Results From Across the Web
Invalid requirement, parse error" error after updating a python ...
This is caused by an issue in setuptools==20.2.1 which is pulled in by IPython ( setuptools>.. ), so a pip install -U updated...
Read more >RequirementParseError: Invalid requirement, parse error at ...
Manually deleting the RequestsThrottler and the references libs futures and concurrent fixes the problem. I would expect pycharm not to brake
Read more >PEP 621: how to specify dependencies? - Packaging
from packaging.requirements import Requirement requirements ... InvalidRequirement: Parse error at "'python_v'": Expected stringEnd.
Read more >A brand new website interface for an even better experience!
pip._vendor.packaging.requirements.InvalidRequirement: Invalid requirement, parse error at "'; extra ' "
Read more >_vendor/packaging/requirements.py · aroundthecode/setuptools
Parse a given requirement string into its parts, such as name, specifier, URL, and extras. Raises InvalidRequirement on a badly-formed requirement string.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yes please.
I think the reason why the grammar behaves like that is because of the following example, that should be a valid url:
poetry @ git+https://github.com/python-poetry/poetry.git@b;ar; ; extra == "foo;"
I was actually wrong, they do add the space when they stringify the object, the thing is that they only do that for URLs.
https://github.com/pypa/packaging/blob/61672bf9f507f38e84ce2786a1c42f55fa0a3153/packaging/requirements.py#L136