CUDA driver initialization failed

Hi! When I try to run any sort of Pytorch code (e.g. torch.cuda.is_available()), I get the following error:

/usr/lib/python3/dist-packages/torch/cuda/__init__.py:83: UserWarning: CUDA initialization: CUDA driver initialization failed, you might not have a CUDA gpu. (Triggered internally at  ../c10/cuda/CUDAFunctions.cpp:109.)
  return torch._C._cuda_getDeviceCount() > 0

Is there anything I can do about this? nvidia-smi says I have “NVIDIA-SMI 515.65.01 Driver Version: 515.65.01 CUDA Version: 11.7”.