2

I need pytorch module to run my project. But When I tried to install it via command prompt via two different ways, it shows an error - Error in cmd installation.

C:\Users\Toothless>pip install torchvision --user
Collecting torchvision
Using cached https://files.pythonhosted.org/packages/b7/ff /091b4503d5f228bd1120db784e2c071617211b965a8a78018e75750c7199/torchvision-0.3.0-cp37-cp37m-win_amd64.whl
Requirement already satisfied: six in c:\users\toothless\appdata\local\programs\python\python37\lib\site-packages (from torchvision) (1.12.0)
Collecting pillow>=4.1.1 (from torchvision)
Downloading https://files.pythonhosted.org/packages/ae/96/6f83deebfcd20a5d4ad35e4e989814a16559d8715741457e670aae1a5a09/Pillow-6.1.0-cp37-cp37m-win_amd64.whl (2.0MB)
 |████████████████████████████████| 2.0MB 27kB/s
Requirement already satisfied: numpy in c:\users\toothless\appdata\local\programs\python\python37\lib\site-packages (from torchvision) (1.17.0)
 Collecting torch>=1.1.0 (from torchvision)
 ERROR: Could not find a version that satisfies the requirement torch>=1.1.0 (from torchvision) (from versions: 0.1.2, 0.1.2.post1, 0.1.2.post2)
 ERROR: No matching distribution found for torch>=1.1.0 (from torchvision)

 C:\Users\Toothless>pip3 install torchvision
 Collecting torchvision
 Using cached https://files.pythonhosted.org/packages/b7/ff/091b4503d5f228bd1120db784e2c071617211b965a8a78018e75750c7199/torchvision-0.3.0-cp37-cp37m-win_amd64.whl
 Requirement already satisfied: six in c:\users\toothless\appdata\local\programs\python\python37\lib\site-packages (from torchvision) (1.12.0)
 Collecting torch>=1.1.0 (from torchvision)
 ERROR: Could not find a version that satisfies the requirement torch>=1.1.0 (from torchvision) (from versions: 0.1.2, 0.1.2.post1, 0.1.2.post2)
 ERROR: No matching distribution found for torch>=1.1.0 (from torchvision)

Again I've tried to installed through pycharm enter image description here.

I've been following this question but conda`` is not listed in my envairoment variable.

Edited: When I tried pip install torch torchvision --user this command it gives an error - ERROR: torchvision 0.3.0 has requirement torch>=1.1.0, but you'll have torch 0.1.2.post2 which is incompatible.

Edited: I've also tried pip install torchvision but it shows with error -

C:\Users\Toothless>pip install torchvision
Collecting torchvision
Using cached https://files.pythonhosted.org/packages/b7/ff/091b4503d5f228bd1120db784e2c071617211b965a8a78018e75750c7199/torchvision-0.3.0-cp37-cp37m-win_amd64.whl
Collecting torch>=1.1.0 (from torchvision)
ERROR: Could not find a version that satisfies the requirement torch>=1.1.0 (from torchvision) (from versions: 0.1.2, 0.1.2.post1, 0.1.2.post2)
ERROR: No matching distribution found for torch>=1.1.0 (from torchvision)

What should i do now to make a workable pytorch?

mefahimrahman
  • 197
  • 2
  • 6
  • 29
  • `pip install conda` for conda – R4444 Aug 06 '19 at 20:07
  • `torchvision` is a supplemental library for pytorch which includes computer-vision specific functions. You need to install `torch` first. Try `pip install torch torchvision --user` – jodag Aug 07 '19 at 04:52

5 Answers5

2

Check with:

pip install torchvision --no-deps

It can be because of the dependencies.

Kermit the Frog
  • 146
  • 2
  • 7
2

Finally I've installed my desired pytorch & torchvision. I've installed it via pip. The commandline I've used to install pytorch:

pip3 install https://download.pytorch.org/whl/cpu/torch-1.1.0-cp37-cp37m-win_amd64.whl

And for torchVision:

pip3 install https://download.pytorch.org/whl/cpu/torchvision-0.3.0-cp37-cp37m-win_amd64.whl

I've found this code from PyTorch website.

The requirement I've used

mefahimrahman
  • 197
  • 2
  • 6
  • 29
2

Before installing, remove old torch and torchvision packages

pip3 uninstall torch
pip3 uninstall torchvision

As torchvision 0.3.0 requires torch>=1.1.0.

Then you can install torch and torchvision

pip3 install torch==1.1.0
pip3 install torchvision==0.3.0
Shez
  • 21
  • 4
1

torchvision is a supplemental library for pytorch which includes computer-vision specific functions. You need to install torch first. Try pip install torch torchvision --user

jodag
  • 19,885
  • 5
  • 47
  • 66
  • It does not work. it shows - **ERROR: torchvision 0.3.0 has requirement torch>=1.1.0, but you'll have torch 0.1.2.post2 which is incompatible.** – mefahimrahman Aug 07 '19 at 14:03
0

If you are using 32 bit python version this could be the reason. I downloaded 64 bit python and torch installation completed.

MrAlbino
  • 308
  • 2
  • 10