Strange issue with PyCuda


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/ =======
Traceback (most recent call last):
File “/home/alain/.local/lib/python3.6/site-packages/pytools/”, 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/”, line 50, in call_capture_output
File “/usr/lib/python3.6/”, line 729, in init
restore_signals, start_new_session)
File “/usr/lib/python3.6/”, 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/”, line 200, in
File “/home/alain/.local/lib/python3.6/site-packages/pycuda/”, line 291, in init
arch, code, cache_dir, include_dirs)
File “/home/alain/.local/lib/python3.6/site-packages/pycuda/”, line 254, in compile
return compile_plain(source, options, keep, nvcc, cache_dir, target)
File “/home/alain/.local/lib/python3.6/site-packages/pycuda/”, line 84, in compile_plain
File “”, line 2, in get_nvcc_version
File “/home/alain/.local/lib/python3.6/site-packages/pytools/”, line 558, in _deco
result = func(*args)
File “/home/alain/.local/lib/python3.6/site-packages/pycuda/”, line 16, in get_nvcc_version
result, stdout, stderr = call_capture_output(cmdline)
File “/home/alain/.local/lib/python3.6/site-packages/pytools/”, 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/”, 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”), 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.



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


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.



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

1 Like