0

I have tried listing the following dependency in pyproject.toml to have this particular torch only be installed when on Windows platforms.

torch = { url = "https://download.pytorch.org/whl/cpu/torch-1.7.0%2Bcpu-cp36-cp36m-win_amd64.whl", platform = "windows"}
torch = { url = "https://download.pytorch.org/whl/cpu/torch-1.7.0%2Bcpu-cp36-cp36m-win_amd64.whl", markers = "sys_platform == 'win32'"}

Regardless, poetry attempts to install it on macOS and linux, causing an error.

  EnvCommandError

  Command ['/home/runner/work/.../.venv/bin/pip', 'install', '--no-deps', '/home/runner/.cache/pypoetry/artifacts/00/91/70/1f0b4cacc2e27f6d54a1d33fccf09212bb25b7559f2e5ee8f457902ed6/torch-1.7.0+cpu-cp36-cp36m-win_amd64.whl'] errored with the following return code 1, and output: 
  ERROR: torch-1.7.0+cpu-cp36-cp36m-win_amd64.whl is not a supported wheel on this platform.

How can torch be listed so that it only installs on Windows platforms?

OneCricketeer
  • 179,855
  • 19
  • 132
  • 245
conner.xyz
  • 6,273
  • 8
  • 39
  • 65
  • Why not add (equivalent of) `torch-1.9.0-cp39-none-macosx_10_9_x86_64.whl` if you are on a Mac? – OneCricketeer Oct 06 '21 at 18:46
  • Adding torch as a dependency on mac/linux doesn't seem to be an issue (Poetry resolves it and everything is fine), it appears that only Windows needs this super specific dependency spec. – conner.xyz Oct 06 '21 at 20:47

1 Answers1

0

This problem should be solved from version 1.2.0b3 as described in this ticket: https://github.com/python-poetry/poetry/issues/1616

Sergio Lema
  • 1,491
  • 1
  • 14
  • 25