Pycuda import issue(nano Jetson Pack 4.6.1, python 3.6.9)

  • Jetson Nano B01
  • JetPack 4.6.1 image burned on SD
  • Python 3.6.9
  • pycuda 2022.1

path env variable added

export PATH=/usr/local/cuda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
export LD_LIBRARY_PATH=/usr/local/cuda/lib64
export CPATH=/usr/local/cuda-10.2/targets/aarch64-linux/include
export LIBRARY_PATH=/usr/local/cuda-10.2/targets/aarch64-linux/lib
export CUDA_ROOT=/usr/local/cuda

Installed pycuda like below without issues

$ sudo apt-get install python3-pip
$ pip3 install pycuda --user

test_driver.py works without issues like below:

python3 ./pycuda-2022.1/test/test_driver.py

However I cannot use pycuda if not under ./pycuda-2022.1/:

~/Desktop/temp$ python3
Python 3.6.9 (default, Mar 10 2023, 16:46:00) 
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pycuda
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/komushi/Desktop/temp/pycuda.py", line 2, in <module>
    import pycuda.autoinit
ModuleNotFoundError: No module named 'pycuda.autoinit'; 'pycuda' is not a package

I have the same issue like this but his resolution does not work in my case.

Hi,

It looks like you have a Python script whose name is pycuda.py.
Is it possible to rename the file?

It looks like Python try to load the script rather than the Pycuda module.

Thanks

you are correct - that temp file is the reason. removed it and everything works fine now. sorry for the stupid error

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