https://pantsbuild.org/ logo
#general
Title
# general
a

average-breakfast-91545

03/20/2023, 1:27 PM
Hitting an error with
poetry_requirements
for everybody's favourite package: Torch. In pyproject.toml I have the following
Copy code
[tool.poetry.group.ml.dependencies]
torch = [
    {markers = "platform_machine == 'arm64' and sys_platform == 'darwin'", url = "<https://download.pytorch.org/>..."},
    {markers = "platform_machine == 'x86_64' and sys_platform == 'darwin'", url = "<https://download.pytorch.org/>..."},
    {markers = "platform_machine == 'x86_64' and sys_platform == 'linux'", url = "<https://download.pytorch.org/>..."}
]
Either this is borked somehow, or there's a bug with parsing, because I'm receiving an error:
Copy code
ValueError: Invalid requirement 'torch @ <https://download.pytorch.org/whl/cpu/torch-1.9.1-cp39-none-macosx_11_0_arm64.whl;(platform_machine> == 'arm64' and sys_platform == 'darwin')': 

Parse error at ""== 'arm6"": Expected string_end
The quoting in the message looks kinda suss. I'm unsure whether I can rewrite these into a form that pants will prefer, or whether I should remove them from pyproject and do something else altogether.
e

enough-analyst-54434

03/20/2023, 1:39 PM
It looks like a bug with parsing to me. I'd definitely file an issue.
👍 1
a

average-breakfast-91545

03/20/2023, 1:40 PM
I'll see if I can create a minimal repro
e

enough-analyst-54434

03/21/2023, 12:51 AM
Thanks for the repro gists Bob. I've got a fix out here that I'll cherry-pick back through 2.15.x and 2.16.x; so you should see the fix available in 2.15.1, 2.16.0 and on main / 2.17.0.
🙌 1
2 Views