PyTorch installs the CPU version no matter what

I’ve been trying to install PyTorch with CUDA support enabled, but have been unsuccessful no matter what I try.

GPU: GTX 1080 Ti
OS: Windows 10
Environment: Anaconda
Python: 3.9.8

I installed Anaconda and ran the following command in the Anaconda Prompt:
conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch.
As far as I can tell, this is how I download the version of PyTorch with GPU support.

This is the output of nvidia-smi:
NVIDIA-SMI 496.49 Driver Version: 496.49 CUDA Version: 11.5

This is what happens when I try to access PyTorch from within the Python3 interpreter:

import torch

> False

> '1.10.0+cpu'

> 0

> AssertionError: Torch not compiled with CUDA enabled

It appears that the CPU version is installed, even though I didn’t select the CPU version on the PyTorch website. What can I do to ensure I install the GPU version? Thanks for all your help!

I ended up solving my own issue through lots of trial and error. It turns out that python3 on my machine is linked to a different python3 environment, not the one that was installed in my conda environment. Launching python with the command python instead of python3 fixed the issue. I’ll leave this post up in case anyone else runs into this in the future :slight_smile: