-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Description
-
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 (
-vvvoption). -
OS version and name: Ubuntu 20.04 (container)
-
Poetry version: 10.1.10
-
Link of a Gist with the contents of your pyproject.toml file: https://gist.github.com/daniel-j-h/789f181c620a97d74f4731b42a88e073
Issue
Hey folks - here is my use case: I work in a self-contained ubuntu:20.04 docker container and want to add a remote wheel
poetry add --platform linux https://download.pytorch.org/whl/cpu/torch-1.5.1%2Bcpu-cp38-cp38-linux_x86_64.whl
This works fine, but when I then poetry build my package and try to install it (even e.g. with pip3) I get the parsing error stack trace attached below.
Small self-contained reproducible example is here: https://gist.github.com/daniel-j-h/789f181c620a97d74f4731b42a88e073
What works tho is leaving out the platform marker and installing with
poetry add https://download.pytorch.org/whl/cpu/torch-1.5.1%2Bcpu-cp38-cp38-linux_x86_64.whl
which semantically is wrong but at least the package then is installable.
When I unzip the wheel I get from poetry build, then in the METADATA file the platform marker looks like this
Requires-Dist: torch @ https://download.pytorch.org/whl/cpu/torch-1.5.1%2Bcpu-cp38-cp38-linux_x86_64.whl; sys_platform == "linux"
And here is the full stack trace when I try to install the package with platform marker
python@154ca81a64c9:~/app$ pip3 install dist/app-0.1.0-py3-none-any.whl
Processing ./dist/app-0.1.0-py3-none-any.whl
ERROR: Exception:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3023, in _dep_map
return self.__dep_map
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2817, in __getattr__
raise AttributeError(attr)
AttributeError: _DistInfoDistribution__dep_map
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pkg_resources/_vendor/packaging/requirements.py", line 90, in __init__
req = REQUIREMENT.parseString(requirement_string)
File "/usr/lib/python3/dist-packages/pkg_resources/_vendor/pyparsing.py", line 1654, in parseString
raise exc
File "/usr/lib/python3/dist-packages/pkg_resources/_vendor/pyparsing.py", line 1644, in parseString
loc, tokens = self._parse( instring, 0 )
File "/usr/lib/python3/dist-packages/pkg_resources/_vendor/pyparsing.py", line 1402, in _parseNoCache
loc,tokens = self.parseImpl( instring, preloc, doActions )
File "/usr/lib/python3/dist-packages/pkg_resources/_vendor/pyparsing.py", line 3417, in parseImpl
loc, exprtokens = e._parse( instring, loc, doActions )
File "/usr/lib/python3/dist-packages/pkg_resources/_vendor/pyparsing.py", line 1406, in _parseNoCache
loc,tokens = self.parseImpl( instring, preloc, doActions )
File "/usr/lib/python3/dist-packages/pkg_resources/_vendor/pyparsing.py", line 3205, in parseImpl
raise ParseException(instring, loc, self.errmsg, self)
pkg_resources._vendor.pyparsing.ParseException: Expected stringEnd (at char 91), (line:1, col:92)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3103, in __init__
super(Requirement, self).__init__(requirement_string)
File "/usr/lib/python3/dist-packages/pkg_resources/_vendor/packaging/requirements.py", line 92, in __init__
raise InvalidRequirement(
pkg_resources.extern.packaging.requirements.InvalidRequirement: Invalid requirement, parse error at "'sys_plat'"
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pip/_internal/cli/base_command.py", line 186, in _main
status = self.run(options, args)
File "/usr/lib/python3/dist-packages/pip/_internal/commands/install.py", line 357, in run
resolver.resolve(requirement_set)
File "/usr/lib/python3/dist-packages/pip/_internal/legacy_resolve.py", line 177, in resolve
discovered_reqs.extend(self._resolve_one(requirement_set, req))
File "/usr/lib/python3/dist-packages/pip/_internal/legacy_resolve.py", line 382, in _resolve_one
set(req_to_install.extras) - set(dist.extras)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 2980, in extras
return [dep for dep in self._dep_map if dep]
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3025, in _dep_map
self.__dep_map = self._compute_dependencies()
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3035, in _compute_dependencies
reqs.extend(parse_requirements(req))
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3096, in parse_requirements
yield Requirement(line)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 3105, in __init__
raise RequirementParseError(str(e))
pkg_resources.RequirementParseError: Invalid requirement, parse error at "'sys_plat'"