"Torch not compiled with CUDA enabled" error, anaconda environment

I am trying to set up and run Stable Diffusion 2.1 on my Ubuntu. It has NVIDIA GeForce RTX 2070 Super graphics card (2560 CUDA Cores, 8192 MB total memory). The VRAM size is barely enough to run the Stable Diffusion, but I know it is possible.

I am being haunted by this just to keep returning to this AssertionError: Torch not compiled with CUDA enabled error. I have been trying to uninstall, reinstall PyTorch in all kinds of ways, just to keep returning to the same error.

I have installed it in a conda environment. Running torch.cuda.is_available() gives False.

What is the suggested way to completely remove PyTorch in order to start anew? I have tried this:

$ pip uninstall torch
$ pip cache purge
$ conda remove pytorch
$ conda clean --all

Then I do

$ conda install pytorch==1.12.1 -c pytorch

When I execute that command, I get the The following packages will be downloaded list, and I see there pytorch-1.12.1 | cpu_py310he8d8e81_0 | 60.9 MB. That “cpu” there in the build name doesn’t look promising. On what basis conda has decided that it’s the right build to download and install? Is there a way I can force specific build?

Please use these install instructions and select a valid CUDA runtime version (11.6 or 11.7) since you are installing the CPU-only conda binaries right now.