12412316
12412316

Reputation: 797

Cannot install torchvision via poetry in windows

I succeeded in pytorch installation thanks to answers here Poetry and PyTorch.

But, I'm still failed to install torchvision via poetry.

> poetry add torchvision==0.8.2

Updating dependencies
Resolving dependencies...

Writing lock file

Package operations: 1 install, 0 updates, 0 removals

  • Installing torchvision (0.8.2)

  RuntimeError

  Unable to find installation candidates for torchvision (0.8.2)

  at ~\.poetry\lib\poetry\installation\chooser.py:72 in choose_for
       68│ 
       69│             links.append(link)
       70│
       71│         if not links:
    →  72│             raise RuntimeError(
       73│                 "Unable to find installation candidates for {}".format(package)
       74│             )
       75│
       76│         # Get the best link


Failed to add packages, reverting the pyproject.toml file to its original content.

I googled it and found some answers that say 'just pip install torchvision'. But I'm suspicious that it works because according to PyPi(https://pypi.org/project/torchvision/#files), there is no wheel file for windows. And I tried it and it failed as I expected.

Is there any way to install latest torchvisin which is compatible with latest torch(1.7.1) in windows? + via poetry?

Upvotes: 3

Views: 6371

Answers (2)

Victor Vrabii
Victor Vrabii

Reputation: 31

I got the same issue, I just reopen terminal and all worked good. I guess I was in some wrong environment.

Upvotes: 0

Dris101
Dris101

Reputation: 469

  1. Look in https://download.pytorch.org/whl/torch_stable.html for the version you want to install (torchvision version, python version, CUDA version, OS etc.)
  2. Add a URL dependency to your pyproject.toml file. For example I have torchvision 1.8.0 working with the following in my dependencies
[tool.poetry.dependencies]
python = "^3.8"
torch = {url = "https://download.pytorch.org/whl/cu102/torch-1.8.0-cp38-cp38-win_amd64.whl"}
torchvision = {url = "https://download.pytorch.org/whl/cu102/torchvision-0.9.0-cp38-cp38-win_amd64.whl"}
  1. From your activated virtual environment do poetry update torchvision and you should be good to go.

Upvotes: 2

Related Questions