Pycuda - 'CUDA_ROOT is not installed, and nvcc is not on the way.'

Although I installed pycuda and used it in order, it ran (without doing sth) so as not to work. So, I tried to install again, but when I do

python configure.py --cuda-root = / usr / local / cuda / bin

he gives me an error in the title.

The nvcc file is located in the above directory.

+7
source share
3 answers

pycuda does not find nvcc. Have you tried adding / usr / local / cuda / bin to the PATH env variable? This is the way I have this setting.

Edit:

As far as I can tell, configure.py does not call the nvcc compiler, it just creates a makefile. I believe this problem occurs when you run sudo -c "make install", which calls setup.py.

A few things to try. Make sure you have CUDA_ROOT installed:

echo $CUDA_ROOT 

If it is empty, install it with:

 export CUDA_ROOT=/usr/local/cuda/bin 

Try running the make command again. Now with -E to save your env:

 sudo -E sh -c "make install" 
+8
source

I ran into the same issue on Slackware64 13.37.

Set the su -c "make install" switch to root (0bv10u5Ly), so CUDA_ROOT must be installed in the root profile. CUDA_ROOT not an environment variable that setup.py uses. Add / usr / local / cuda / bin to PATH and define CUDA_ROOT=/usr/local/cuda/bin , then try installing again.

This is a quick and dirty way, but if none of the above actions are for you, like me below will definitely work. (

Remove

 nvcc_path = search_on_path(["nvcc", "nvcc.exe"]) if nvcc_path is None: print("*** CUDA_ROOT not set, and nvcc not in path. Giving up.") sys.exit(1) 

and install

 cuda_root_default = "/usr/local/cuda/bin" 

in the setup.py file. Then try su -c "make install" .

+1
source

In my case, I had to set CUDA_ROOT=/usr/local/cuda , because with /usr/local/cuda/bin path, he could not find the include folder and he did not find cuda.h with an error.

+1
source

All Articles