Fading Coder

One Final Commit for the Last Sprint

Home > Tech > Content

Setting Up PyTorch with GPU Support on Windows 10 in Under 10 Minutes

Tech 1

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.

Related Articles

Understanding Strong and Weak References in Java

Strong References Strong reference are the most prevalent type of object referencing in Java. When an object has a strong reference pointing to it, the garbage collector will not reclaim its memory. F...

Comprehensive Guide to SSTI Explained with Payload Bypass Techniques

Introduction Server-Side Template Injection (SSTI) is a vulnerability in web applications where user input is improper handled within the template engine and executed on the server. This exploit can r...

Implement Image Upload Functionality for Django Integrated TinyMCE Editor

Django’s Admin panel is highly user-friendly, and pairing it with TinyMCE, an effective rich text editor, simplifies content management significantly. Combining the two is particular useful for bloggi...

Leave a Comment

Anonymous

◎Feel free to join the discussion and share your thoughts.