ModuleNotFoundError: No module named 'pycuda._driver

Traceback (most recent call last):
File “”, line 2, in
import pycuda.autoinit
File “/home/ljx/pycuda2/pycuda-2021.1/pycuda/”, line 1, in
import pycuda.driver as cuda
File “/home/ljx/pycuda2/pycuda-2021.1/pycuda/”, line 65, in
from pycuda._driver import * # noqa
ModuleNotFoundError: No module named ‘pycuda._driver’



Have you installed the pycuda library first?
You can do this with the following command:

$ export PATH=/usr/local/cuda-10.2/bin:$PATH
$ export LD_LIBRARY_PATH=/usr/local/cuda-10.2/lib64:$LD_LIBRARY_PATH
$ pip3 install pycuda --user


OK, I think I’ve solved it. He can’t compile under the path of source code installation. If he writes the program under another path again, he won’t report an error

Good to know this.
Thanks for the feedback.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.