Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install error on Ubuntu 14.04, CUDA 6.5 with setup.py/pip #36

Closed
flavianh opened this issue Dec 16, 2014 · 13 comments
Closed

Install error on Ubuntu 14.04, CUDA 6.5 with setup.py/pip #36

flavianh opened this issue Dec 16, 2014 · 13 comments

Comments

@flavianh
Copy link

nvcc -I/usr/include/python2.7 -c cudamat/cudamat.cu -o build/temp.linux-x86_64-2.7/cudamat/cudamat.o -O --ptxas-options=-v --compiler-options '-fPIC' unable to execute nvcc: No such file or directory error: command 'nvcc' failed with exit status 1

There is little chance that this comes from my configuration, since I reverted to a346369 and ran make and the tests successfully.

@scttl
Copy link
Contributor

scttl commented Dec 16, 2014

Per the installation instructions were you trying to install system-wide via sudo or just under your user directory?

Can you also supply the permissions of nvcc as well? The output of either sudo ls -l $(which nvcc) or ls -l $(which nvcc) depending on the type of install you're attempting should do the trick.

@flavianh
Copy link
Author

I tried both!

$ sudo ls -l $(which nvcc)
-rwxr-xr-x 1 root root 209624 Nov 26 09:56 /usr/local/cuda-6.5/bin/nvcc

@f0k
Copy link
Contributor

f0k commented Dec 17, 2014

Interesting. For me it installs fine under Ubuntu 14.04 and CUDA 6.5. Why does your shell find nvcc and setuptools doesn't? Did you add /usr/local/cuda/bin (or /usr/local/cuda-6.5/bin) to your PATH environment variable? Can you add a print 'PATH =', os.environ.get('PATH') line to the top of the setup.py file to check (after the imports)?

@flavianh
Copy link
Author

Yes, cuda is in PATH. Plus otherwise it would not compile when I call make on your previous commit.

@f0k
Copy link
Contributor

f0k commented Dec 17, 2014

Still:

Can you add a print 'PATH =', os.environ.get('PATH') line to the top of the setup.py file to check (after the imports)?

There must be something different. Unless we're misinterpreting the error message and it finds nvcc, but nvcc is missing something.

@scttl
Copy link
Contributor

scttl commented Dec 17, 2014

One other thing that would help us try and track down the source of the error would be to add '--verbose' to the nvcc_compile_args list in setup.py. Then try to install again, and paste the full output of that command.

@flavianh
Copy link
Author

I did not see you meant in the setup.py. I just did it, cuda is not inside.
This is because I modified the PATH environment variable inside my user's .bashrc file. The CUDA post installation notes tell you to add the environment variables manually here.
It works fine now!

@TheodoreG
Copy link

When I add the print 'PATH =', os.environ.get('PATH') line to the setup.py, it shows /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin.Clearly nvcc compiler is not the path, then I tried PATH = PATH + ":/usr/local/cuda-7.5/bin", it still doesn't work and still shows unable to execute 'nvcc': No such file or directory, what should I do? I've already add the nvcc path to the .bashrc file.

@f0k
Copy link
Contributor

f0k commented Oct 26, 2016

Clearly nvcc compiler is not the path, then I tried PATH = PATH + ":/usr/local/cuda-7.5/bin", it still doesn't work

This doesn't change where nvcc is searched for, that PATH is just a backup of the environment variable to avoid Anaconda sneaking in a wrong MSVC version on Windows. You'd need to modify os.environ['PATH'], or just change your PATH environment variable. Did you restart your terminal after changing the .bashrc? You can try echo $PATH to see if the path is correct.

Note that when you're using sudo, the PATH will be overridden, no matter what you set it to. You can do sudo PATH="$PATH" ... to have the environment carry over.

@TheodoreG
Copy link

TheodoreG commented Apr 7, 2017 via email

@0ut0fcontrol
Copy link

Try not run python in the directory "cudamat".
This is some lines in INSTALL.md

cd test  # so it doesn't try importing cudamat from the source directory
# Run tests
nosetests
# Run benchmark
python ../examples/bench_cudamat.py

@nateGeorge
Copy link

@flavianh I don't know how you got it to work, even with nvcc in my sudo and user path, it wouldn't work. I had to change the lines:

class CUDA_build_ext(build_ext):
    """
    Custom build_ext command that compiles CUDA files.
    Note that all extension source files will be processed with this compiler.
    """
    def build_extensions(self):
        self.compiler.src_extensions.append('.cu')
        self.compiler.set_executable('compiler_so', 'nvcc')
        self.compiler.set_executable('linker_so', 'nvcc --shared')
        if hasattr(self.compiler, '_c_extensions'):
            self.compiler._c_extensions.append('.cu')  # needed for Windows
        self.compiler.spawn = self.spawn
        build_ext.build_extensions(self)

to

class CUDA_build_ext(build_ext):
    """
    Custom build_ext command that compiles CUDA files.
    Note that all extension source files will be processed with this compiler.
    """
    def build_extensions(self):
        self.compiler.src_extensions.append('.cu')
        self.compiler.set_executable('compiler_so', '/usr/local/cuda/bin/nvcc')
        self.compiler.set_executable('linker_so', '/usr/local/cuda/bin/nvcc --shared')
        if hasattr(self.compiler, '_c_extensions'):
            self.compiler._c_extensions.append('.cu')  # needed for Windows
        self.compiler.spawn = self.spawn
        build_ext.build_extensions(self)

Note that I had to provide the full path to nvcc for it to work.

@f0k
Copy link
Contributor

f0k commented Nov 7, 2017

@nateGeorge: What about pip install http://github.com/f0k/cudamat/archive/simplify-compile.zip, does this fail as well? It's a little different, but not sure if this would help. Did you try installing with sudo or without?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants