python-poetry / poetry

Python packaging and dependency management made easy
https://python-poetry.org
MIT License
31.61k stars 2.26k forks source link

pytorch and poetry #4231

Closed yonimedhub closed 2 years ago

yonimedhub commented 3 years ago

Issue

pytorch is now pep503 compliant (https://github.com/pytorch/pytorch/issues/25639#issuecomment-861707149) but I still can't add torch and torchvision. I've tried using this:

torch = {url = "https://download.pytorch.org/whl/cu111/torch-1.9.0%2Bcu111-cp38-cp38-linux_x86_64.whl"}
torchvision = {url = "https://download.pytorch.org/whl/cu111/torchvision-0.10.0%2Bcu111-cp38-cp38-linux_x86_64.whl"}

but got this:

Updating dependencies
Resolving dependencies... (326.0s)

  SolverProblemError

  Because torchvision (0.10.0+cu111) depends on torch (1.9.0)
   and  depends on torch (1.9.0+cu111), torchvision is forbidden.
  So, because  depends on torchvision (0.10.0+cu111), version solving failed.

and if I try using

 [[tool.poetry.source]]
 name = "torch_rep"
 url = "https://download.pytorch.org/whl/cu111/"

I end up disabling the pypi and can't download anything else...

rjurney commented 1 year ago

@david-waterworth I am confused.

I specifically excluded 2.0.1 because that version was accidentally shipped without the nvidia dependencies, and I specify torch as an explicit dependency before any other packages that themselves require torch such as transformers) until today.

If the current version is 2.1.0 - isn't that what it is likely to try to use - thus avoiding the 2.0.1 problem? Or does it still happen?

david-waterworth commented 1 year ago

Sorry I wasn't clearm yes it's trying to use 2.1.0 which is also broken. There's an issue with the torch packaging, which results in the metadata for dependencies not being correctly uploaded to PyPi (as I understand it). Both 2.0.1 and 2.1.0 are affected so cannot be installed with poetry.

setting

torch = {version = ">=2.0.0, !=2.0.1, !=2.1.0"}

prevents the poetry failure, and 2.1.1 is apparently being prepared to fix the problem on the torch side.

naarkhoo commented 10 months ago

any better solution than https://github.com/python-poetry/poetry/issues/4231#issuecomment-1465949597

github-actions[bot] commented 8 months ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.