Strange issue with PyCuda

Hello,

i have a strange issue with PyCuda.

When i use my Python IDLE, i have this message error when i launch the program :

Python 3.6.9 (default, Apr 18 2020, 01:56:04)
[GCC 8.4.0] on linux
Type “help”, “copyright”, “credits” or “license()” for more information.

======= RESTART: /home/alain/Work/Python/JetsonSky/JetsonSky_V1_01.py =======
Traceback (most recent call last):
File “/home/alain/.local/lib/python3.6/site-packages/pytools/init.py”, line 555, in _deco
return func._memoize_dic[args] # pylint: disable=protected-access
AttributeError: ‘function’ object has no attribute ‘_memoize_dic’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/home/alain/.local/lib/python3.6/site-packages/pytools/prefork.py”, line 50, in call_capture_output
stderr=PIPE)
File “/usr/lib/python3.6/subprocess.py”, line 729, in init
restore_signals, start_new_session)
File “/usr/lib/python3.6/subprocess.py”, line 1364, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: ‘nvcc’: ‘nvcc’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/home/alain/Work/Python/JetsonSky/JetsonSky_V1_01.py”, line 200, in
“”")
File “/home/alain/.local/lib/python3.6/site-packages/pycuda/compiler.py”, line 291, in init
arch, code, cache_dir, include_dirs)
File “/home/alain/.local/lib/python3.6/site-packages/pycuda/compiler.py”, line 254, in compile
return compile_plain(source, options, keep, nvcc, cache_dir, target)
File “/home/alain/.local/lib/python3.6/site-packages/pycuda/compiler.py”, line 84, in compile_plain
checksum.update(get_nvcc_version(nvcc).encode(“utf-8”))
File “”, line 2, in get_nvcc_version
File “/home/alain/.local/lib/python3.6/site-packages/pytools/init.py”, line 558, in _deco
result = func(*args)
File “/home/alain/.local/lib/python3.6/site-packages/pycuda/compiler.py”, line 16, in get_nvcc_version
result, stdout, stderr = call_capture_output(cmdline)
File “/home/alain/.local/lib/python3.6/site-packages/pytools/prefork.py”, line 227, in call_capture_output
return forker.call_capture_output(cmdline, cwd, error_on_nonzero)
File “/home/alain/.local/lib/python3.6/site-packages/pytools/prefork.py”, line 61, in call_capture_output
% (" ".join(cmdline), e))
pytools.prefork.ExecError: error invoking ‘nvcc --version’: [Errno 2] No such file or directory: ‘nvcc’: ‘nvcc’

When i launch my program with a terminal (“python3 JetsonSky_V1_01.py”), everything runs fine.

I also tried to Thonny IDE but i have the same problem.

Any idea about this issue ?

Many thanks in advance.

Have a nice day.

Alain

Hi,

This is because that the CUDA binary folder is exported in the terminal (${HOME}/.bashrc) but not in the IDE environment.
Please add this environment parameter to your IDE to solve this issue:

export PATH=/usr/local/cuda-10.2/bin:$PATH

Thanks.

Hello AastaLLL,

many thanks for your reply.

It’s quite logical ! I have set the environment parameters in ${HOME}/.bashrc but you are right, i did not set anything in my IDE environment.

But, as i am a kind of “newbie”, i do not know how to set the CUDA environment parameter in my IDE (IDLE, most basic IDE i guess).

I will search how to fix that but if you have some extra informations, they are welcome.

Have nice day.

Alain

Hi,

Usually, you can find it on the build or link option.
Thanks.

1 Like