How to install PyTorch with PIP

This tutorial provides steps for installing PyTorch on windows with PIP for CPU and CUDA devices.

PyTorch installation with Pip on Windows

PyTorch installation on Windows with PIP for CPU

      
pip3 install torch torchvision torchaudio

    

PyTorch installation on Windows with PIP for CUDA 10.2

        
pip3 install torch==1.10.0+cu102 torchvision==0.11.1+cu102 torchaudio===0.10.0+cu102 -f https://download.pytorch.org/whl/cu102/torch_stable.html
 
    

PyTorch installation on Windows with PIP for CUDA 11.3

        
pip3 install torch==1.10.0+cu113 torchvision==0.11.1+cu113 torchaudio===0.10.0+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html

    

PyTorch installation with Pip on Linux

PyTorch installation on Linux with PIP for CPU


pip3 install torch==1.10.0+cpu torchvision==0.11.1+cpu torchaudio==0.10.0+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html

PyTorch installation on Linux with PIP for CUDA 10.2


pip3 install torch torchvision torchaudio

PyTorch installation on Linux with PIP for CUDA 11.3


pip3 install torch==1.10.0+cu113 torchvision==0.11.1+cu113 torchaudio==0.10.0+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html

PyTorch installation with Pip on Mac

PyTorch installation on Mac with PIP for CPU


pip3 install torch torchvision torchaudio

Verify installation


import torch

print(torch.__version__)



Follow US on Twitter:

Category: PyTorch

Python For Beginners