How to install PyTorch with PIP

This tutorial provides steps for installing PyTorch on Windows, Linux and Mac with PIP for CPU and CUDA devices.

PyTorch installation 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 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 on Mac

PyTorch installation on Mac with PIP for CPU

pip3 install torch torchvision torchaudio

Verify installation

import torch

print(torch.__version__)



Category: PyTorch