pycuda — 'CUDA_ROOT not set, and nvcc not in path.'

让人想犯罪 __ 提交于 2019-12-29 08:33:07

问题


Although i had installed pycuda and using it ok,it started (without doing sth) not to work.So,i i tried to do the install again ,but when i am doing

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

it gives me the error in the title.

The nvcc file is in the above directory.


回答1:


pycuda is not finding nvcc. Did you try adding /usr/local/cuda/bin to your env PATH variable? That's the way I have this setup.

Edit:

As far as I can tell the configure.py doesn't call nvcc compiler it just creates the the makefile. I take that this problem happens when you run sudo -c "make install" which calls setup.py.

A couple of things to try. Make sure that you have CUDA_ROOT set:

echo $CUDA_ROOT

If it's empty, set it with:

export CUDA_ROOT=/usr/local/cuda/bin

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

sudo -E sh -c "make install"



回答2:


I encountered the same issue on a Slackware64 13.37.

Install command su -c "make install" switches to root (0bv10u5Ly) thus CUDA_ROOT should be set in the root's profile. CUDA_ROOT is not an environment variable, it's used by the setup.py. Add /usr/local/cuda/bin to PATH and define CUDA_ROOT=/usr/local/cuda/bin then try to install again.

This is the quick and dirty way but if none of above worked out 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 set

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

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




回答3:


In my case, I had to set CUDA_ROOT=/usr/local/cuda because with /usr/local/cuda/bin path, it was not able find include folder and it was failing with error didn't find cuda.h.



来源:https://stackoverflow.com/questions/8368815/pycuda-cuda-root-not-set-and-nvcc-not-in-path

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!