Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install pytorch in windows?

I am trying to install pytorch on windows and there is one which is available for it but shows an error.

conda install -c peterjc123 pytorch=0.1.12
like image 485
Pratik Sapkota Avatar asked Dec 11 '17 14:12

Pratik Sapkota


People also ask

Can we install PyTorch on Windows?

Currently, PyTorch on Windows only supports Python 3. x; Python 2. x is not supported. After the installation is complete, verify your Anaconda and Python versions.

How do you install PyTorch?

To install PyTorch, you have to run the installation command of PyTorch on your command prompt. This command is available on https://pytorch.org/. Select language and cuda version as per your requirement. Now, run python -version, and Conda -version command to check Conda and python packages are installed or not.


4 Answers

Warning: Unless you have a very specific reason not to, just follow the official installation instructions from https://pytorch.org. They are far more likely to be accurate and up-to-date.


Here is how to install the PyTorch package from the official channel, on Windows using Anaconda, as of the time of writing this comment (31/03/2020):

PyTorch without CUDA:

conda install pytorch torchvision cpuonly -c pytorch

PyTorch with CUDA 10.1:

conda install pytorch torchvision cudatoolkit=10.1 -c pytorch
like image 178
suimizu Avatar answered Oct 17 '22 00:10

suimizu


go to the official website: http://pytorch.org/

  1. Select Windows as your operating system
  2. Select your Package Manager such as pip or conda
  3. Select you python version
  4. Select CUDA or choose none You will get the command that will install pytorch on your system based on your selection.

For example, if you choose Windows, pip, python 3.6 and none in the listed steps, you will get the following commands:

pip3 install http://download.pytorch.org/whl/cpu/torch-0.4.0-cp36-cp36m-win_amd64.whl 
pip3 install torchvision
like image 37
DK250 Avatar answered Oct 17 '22 01:10

DK250


If you are trying to install on windows 10 and you are not having the anaconda installation than the best options are below:

Python 2.7

pip install https://download.pytorch.org/whl/cpu/torch-1.0.1-cp27-cp27mu-linux_x86_64.whl
pip install torchvision

If the above command does not work, then you have python 2.7 UCS2, use this command

pip install https://download.pytorch.org/whl/cpu/torch-1.0.1-cp27-cp27m-linux_x86_64.whl

Python 3.5

pip3 install https://download.pytorch.org/whl/cpu/torch-1.0.1-cp35-cp35m-win_amd64.whl
pip3 install torchvision

Python 3.6

pip3 install https://download.pytorch.org/whl/cpu/torch-1.0.1-cp36-cp36m-win_amd64.whl
pip3 install torchvision

Python 3.7

pip3 install https://download.pytorch.org/whl/cpu/torch-1.0.1-cp37-cp37m-win_amd64.whl
pip3 install torchvision
like image 10
Navin Dalal Avatar answered Oct 17 '22 00:10

Navin Dalal


Actual answer:


Best way is to check on the official website for up-to-date options. Here are the ones working as of 2020-03:

# for windows 10, CUDA 10.1
conda install pytorch torchvision cudatoolkit=10.1 -c pytorch

#for windows 10, CUDA 9
conda install pytorch torchvision cudatoolkit=9.2 -c pytorch -c defaults -c numba/label/dev 

Previous answer(out-of-date)


It seems that the author (peterjc123) released 2 days ago conda packages to install PyTorch 0.3.0 on windows. Here is a copy:

# for Windows 10 and Windows Server 2016, CUDA 8
conda install -c peterjc123 pytorch cuda80

# for Windows 10 and Windows Server 2016, CUDA 9
conda install -c peterjc123 pytorch cuda90

# for Windows 7/8/8.1 and Windows Server 2008/2012, CUDA 8
conda install -c peterjc123 pytorch_legacy cuda80

source: https://github.com/pytorch/pytorch/issues/494#issuecomment-350527200

like image 10
x0s Avatar answered Oct 17 '22 01:10

x0s