"Could not find cuda drivers on your machine, GPU will not be used."?

so far i have been running all the notebooks of course01 in WSL (Linux) on my windows machine.
but when i try to run the stable diffusion notebook of course02 (GitHub - fastai/diffusion-nbs: Getting started with diffusion) on WSL, i get the above error:

“Could not find cuda drivers on your machine, GPU will not be used.”

Do i need to run stable diffusion notebooks from a windows terminal rather than WSL Linux?
I am a bit worried about messing up my system if i try and install specific nvidia drivers for WSL to get stable diffusion running.

what is the best practice/workaround for this? I am sure others have run into this issue before.


i should add that i do have a working stable diffusion installation in windows that i run from a shell/terminal - but for consistency i would prefer to keep my fastai course material in the Linux world, if possible.

What is the output of ‘nvidia-smi’ from the WSL shell?

that’s what i get:

Command ‘nvidia-smi’ not found, but can be installed with:
sudo apt install nvidia-utils-390 # version 390.157-0ubuntu0.22.04.1, or
sudo apt install nvidia-utils-418-server # version 418.226.00-0ubuntu5~
sudo apt install nvidia-utils-450-server # version 450.236.01-0ubuntu0.22.04.1
sudo apt install nvidia-utils-470 # version 470.182.03-0ubuntu0.22.04.1
sudo apt install nvidia-utils-470-server # version 470.182.03-0ubuntu0.22.04.1
sudo apt install nvidia-utils-510 # version 510.108.03-0ubuntu0.22.04.1
sudo apt install nvidia-utils-515 # version 515.105.01-0ubuntu0.22.04.1
sudo apt install nvidia-utils-515-server # version 515.105.01-0ubuntu0.22.04.1
sudo apt install nvidia-utils-525 # version 525.105.17-0ubuntu0.22.04.1
sudo apt install nvidia-utils-525-server # version 525.105.17-0ubuntu0.22.04.1
sudo apt install nvidia-utils-510-server # version 510.47.03-0ubuntu3

if these drivers(?) don’t mess up my windows drivers, then it shouldn’t be a problem to install them, i guess?

If you followed the instructions @ NVIDIA GPU Accelerated Computing on WSL 2

Those packages should not be needed.

I don’t have WSL2, I have WSL1.
there were some bugs/issues with getting WSL2 work.

Pretty sure that GPU pass-thru is not supported in WSL1

And you need Windows 10 build 20150 or greater, or Win 11 to have WSL2 with GPU pass-thru support.

ok, good to know, thank you

funny enough, i didn’t have any issues running the learners (for image classification etc) in part1
my GPU was heavily in use there.
I assume that stable diffusion requires more specific drivers, then?

ok, this is getting annoying - am back in windows environment, skipping WSL. I set up a local env to install the stable diffusion pipeline and the necessary packages - and now i run into this error:

“AssertionError: Torch not compiled with CUDA enabled”

really strange, since i do have a fully working installation of stable diffusion running in a different env (automatic1111), that’s obviously using my GPU(s)

it won’t stop me from following the course material, i can do that on colab etc, but i am really frustrated that i can not run these things locally

| NVIDIA-SMI 516.94 Driver Version: 516.94 CUDA Version: 11.7

LOL. I ran into this exact problem today…

How are you building your environment?
if using environment.yml: replace the pytorch line with

– pytorch=*=cuda

if manually installing using conda

conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia

if manually installing using pip

pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118

1 Like

i just did ‘python -m venv env’ and then installed all packages in that environment
i will try and set up a new one from scratch later today

reinstalling the packages in a new environment seemed to do the trick.