9

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.

George
  • 5,808
  • 15
  • 83
  • 160

3 Answers3

11

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"
jkysam
  • 5,533
  • 1
  • 21
  • 16
  • If you mean the bashrc file ,the contents are:#PATH=~/bin:$PATH export PATH=/usr/local/cuda/bin:$PATH export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH .The nvcc is working ok,from wherever i call it – George Dec 03 '11 at 17:10
  • are you switching users or using sudo when you run python configure.py? – jkysam Dec 03 '11 at 17:27
  • i use sudo when i do 'make install'.i don't switch users ever.(when doing python configure i don't use sudo) – George Dec 03 '11 at 17:41
  • :In the command 'sudo -E myuser -c "make install"' , where myuser i am writting the user,right?But it doesn't work.It says command not found.The first time i installed it without problem with the sudo make install command. – George Dec 04 '11 at 14:43
  • hmmm this is strange. what platform are you using? I looked at the setup.py code and the error you get is thrown only if the user doesn't have CUDA_ROOT defined as an env variable. – jkysam Dec 04 '11 at 23:20
  • :I am using linux mint 11 (ubuntu).The first time i didn't have a problem!What can i do now? – George Dec 05 '11 at 10:11
  • fixed the sudo command also check out http://stackoverflow.com/questions/257616/sudo-changes-path-why I don't know why you didn't see this problem before, are you using the same os, user...? – jkysam Dec 05 '11 at 14:33
  • :I added the "alias sudo='sudo env PATH=$PATH'" in my ./bashrc and now it did it!But,i used the sudo command you said above ,without the 'E' , because when i used 'E' it gave me "env: -E: No such file or directory".Anyway,now i have pycuda running!Thanks a lot for your help these days! – George Dec 05 '11 at 14:58
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".

Tshilidzi Mudau
  • 7,373
  • 6
  • 36
  • 49
y33t
  • 649
  • 4
  • 14
  • 23
2

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.

Tshilidzi Mudau
  • 7,373
  • 6
  • 36
  • 49
Deepak Sharma
  • 582
  • 8
  • 10