Friday, December 27, 2024
Google search engine
HomeLanguagesInstall Pytorch on Windows

Install Pytorch on Windows

In this article, we will learn how to install Pytorch on Windows. PyTorch is an open-source machine learning library based on the Torch library, used for applications such as computer vision and natural language processing, primarily developed by Facebook’s AI Research lab. It is free and open-source software released under the Modified BSD license.

Method 1: Using pip

Step 1: Check if python is already installed by entering the following command in the command prompt.

python –version

If this command runs successfully, and we are able to get a Python version then we are good to go or else install python by referring to How to install Python on Windows?

Step 2: Check if pip is already installed by entering the following command in the command prompt.

pip –version

If this command runs successfully, and we are able to get a pip version then we are good to go or else install pip by referring to this article Download and install pip Latest Version.

Step 3: Enter any one of the following commands (according to your system specifications) to install the latest stable release of Pytorch.

1. Compute Platform: CUDA 10.2, Nvidia Driver version should be >= 441.22

pip3 install torch==1.8.1+cu102 torchvision==0.9.1+cu102 torchaudio===0.8.1 -f https://download.pytorch.org/whl/torch_stable.html

2. Compute Platform: CUDA 11.1, Nvidia Driver version should be >= 456.38

pip3 install torch==1.8.1+cu111 torchvision==0.9.1+cu111 torchaudio===0.8.1 -f https://download.pytorch.org/whl/torch_stable.html

3. Compute Platform: CPU

 pip3 install torch==1.8.1+cpu torchvision==0.9.1+cpu torchaudio===0.8.1 -f https://download.pytorch.org/whl/torch_stable.html

Step 4: Check if Pytorch is successfully installed by entering the following command in the command prompt.

pip3 show torch

Method 2: Using conda

Step 1: Check if conda is installed by entering the following command in Anaconda Prompt.

conda –version

If this command runs successfully, and we are able to get a conda version then we are good to go or else install Anaconda by referring to this article How to install Anaconda on windows?

Step 2: Open Anaconda Prompt in Administrator mode and enter any one of the following commands (according to your system specifications) to install the latest stable release of Pytorch.

1. Compute Platform: CUDA 10.2, Nvidia Driver version should be >= 441.22

conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch

2. Compute Platform: CUDA 11.1, Nvidia Driver version should be >= 456.38

conda install pytorch torchvision torchaudio cudatoolkit=11.1 -c pytorch -c conda-forge

3. Compute Platform: CPU

conda install pytorch torchvision torchaudio cpuonly -c pytorch

Step 3: Check if Pytorch is successfully installed by entering the following command in Anaconda prompt.

conda list -f pytorch

RELATED ARTICLES

Most Popular

Recent Comments