I have previously import pycuda.autoinit module but when I try to run the code I still get an error
4 # Initialize CUDA
----> 5 cuda.init()
6
7 from pycuda.tools import make_default_context # noqa: E402
RuntimeError: cuInit failed: no CUDA-capable device is detected
Be sure to have the proper CUDA version installed in your PC, different hardware need different version of CUDA installed. You can check from: https://developer.nvidia.com/cuda-gpus