Cuda fails to initializes

I have installed PyTorch using conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch
Installation is done with no error. However, when I import torch I get an error that cuda fails to initialize. You may not have gpu.
Does anyone know why this happen?

Is your machine a linux machine?.
Does your machine have an nvidia gpu?
If so try nvidia-smi if it fails you will have to install nvidia drivers.

For a cpu machine you can set cuda false and proceed or use torch version with just cpu support

Thank you for your reply. My OS is Windows 10. I have NVIDIA gpu. I want to install the gpu version. Can it be related to the fact that the gpu drivers may not be up to date?

That could be the case. On my Windows laptop I’m using an older 452.06 driver and can properly run the 1.12.0+cu116 binary as described here.

Thanks. My driver version is 391.33, and gpu Quadro p5000.
Do I need to have administrative access to upgrade the drivers?

By the way, I installed using conda not pip.

Yes, I guess you need admin permissions to update the driver.

1 Like