Setting Up PyTorch with GPU Support on Windows 10 in Under 10 Minutes
Begin with an existing Python 3.6.8 installation—no need to reinstall Python.
1. Install Anaconda
Use Anaconda version 2019.03, which is compatible with Python 3.6.8. Successful installasion can be confirmed by running conda --version in the terminal.
2. Configure Package Mirrors
Avoid the Tsinghua mirrror—it has been known to incorrectly substitute CPU-only packages when GPU support is intended. Instead, use the University of Science and Technology of China (USTC) mirror:
First, reset any existing channels:
conda config --remove-key channels
Then add USTC mirrors:
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/msys2/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/bioconda/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/menpo/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/pytorch/
conda config --set show_channel_urls yes
Verify the configuration:
conda info
This creates or updates the .condarc file in your user directory (C:\Users\<username>\).
3. Create and Activate a Virtual Environment
Set up a dedicated environment for PyTorch:
conda create --name py36 python=3.6
conda activate py36
4. Install PyTorch with CUDA Support
With the py36 environment active, install PyTorch using the official command from pytorch.org, but omit the -c pytorch flag since the USTC channel already includes PyTorch packages:
conda install pytorch torchvision torchaudio cudatoolkit=11.3
5. Verify GPU Availability
After installation, confirm CUDA is accessible:
import torch
print(torch.cuda.is_available())
If the output is True, the GPU-enabled PyTorch setup is successful.