How to install pytorch on Windows


Step 1: install python, example: Python 3.7.9

https://www.python.org/ftp/python/3.7.9/python-3.7.9-amd64.exe

Note: with windows 7 must update:
X64: https://download.microsoft.com/download/F/1/0/F106E158-89A1-41E3-A9B5-32FEB2A99A0B/Windows6.1-KB2533623-x64.msu
X86: https://download.microsoft.com/download/2/D/7/2D78D0DD-2802-41F5-88D6-DC1D559F206D/Windows6.1-KB2533623-x86.msu

Step 2: you can build your own command here: https://pytorch.org/#pip-install-pytorch

Example:

pip install torch===1.6.0 torchvision===0.7.0 -f https://download.pytorch.org/whl/torch_stable.html

Result:

C:\Users\Administrator>pip install torch===1.6.0 torchvision===0.7.0 -f https://
download.pytorch.org/whl/torch_stable.html
Looking in links: https://download.pytorch.org/whl/torch_stable.html
Collecting torch===1.6.0
  Downloading https://download.pytorch.org/whl/cu102/torch-1.6.0-cp37-cp37m-win_
amd64.whl (1077.4 MB)
     |████████████████████████████████| 1077.4 MB 5.6 kB/s
Collecting torchvision===0.7.0
  Downloading https://download.pytorch.org/whl/cu102/torchvision-0.7.0-cp37-cp37
m-win_amd64.whl (1.1 MB)
     |████████████████████████████████| 1.1 MB 6.8 MB/s
Requirement already satisfied: numpy in c:\users\administrator\appdata\local\pro
grams\python\python37\lib\site-packages (from torch===1.6.0) (1.15.2)
Collecting future
  Downloading future-0.18.2.tar.gz (829 kB)
     |████████████████████████████████| 829 kB 930 kB/s
Requirement already satisfied: pillow>=4.1.1 in c:\users\administrator\appdata\l
ocal\programs\python\python37\lib\site-packages (from torchvision===0.7.0) (6.2.
2)
Building wheels for collected packages: future
  Building wheel for future (setup.py) ... done
  Created wheel for future: filename=future-0.18.2-py3-none-any.whl size=491062
sha256=cacf378e9e040cacdaf6012ab0bbad375fa1165b3c74392f6a865eb4c0f4151c
  Stored in directory: c:\users\administrator\appdata\local\pip\cache\wheels\56\
b0\fe\4410d17b32f1f0c3cf54cdfb2bc04d7b4b8f4ae377e2229ba0
Successfully built future
Installing collected packages: future, torch, torchvision
Successfully installed future-0.18.2 torch-1.6.0 torchvision-0.7.0

Note:
* Download CUDA toolkit 10.2 here: https://developer.nvidia.com/cuda-10.2-download-archive?target_os=Windows&target_arch=x86_64

* CUDA 10.2.89 needs Nvidia Graphics Driver >=440.33

Table 1. CUDA Toolkit and Compatible Driver Versions
CUDA Toolkit x86_64 Driver Version
CUDA 11.0 (11.0.171) >= 450.36.06
CUDA 10.2 (10.2.89) >= 440.33
CUDA 10.1 (10.1.105) >= 418.39
CUDA 10.0 (10.0.130) >= 410.48
CUDA 9.2 (9.2.88) >= 396.26
CUDA 9.1 (9.1.85) >= 390.46
CUDA 9.0 (9.0.76) >= 384.81
CUDA 8.0 (8.0.61 GA2) >= 375.26
CUDA 8.0 (8.0.44) >= 367.48
CUDA 7.5 (7.5.16) >= 352.31
CUDA 7.0 (7.0.28) >= 346.46

Recent search terms:

  • pytorch tutorials

Leave a Reply