67

I'm trying to install CUDA 7.5 in my ubuntu 14.04. I followed everything in this guide (installation through package): http://developer.download.nvidia.com/compute/cuda/7.5/Prod/docs/sidebar/CUDA_Installation_Guide_Linux.pdf until post build section. Mainly, by running the following commands:

sudo dpkg -i cuda-repo-ubuntu1404-7-5-local_7.5-18_amd64.deb
sudo apt-get update
sudo apt-get install cuda

The thing is the folder /usr/local/cuda* does not exist after successful CUDA installation. Further trying to install cuda says that it is already the newest version.

sudo apt-get install cuda
Reading package lists... Done
Building dependency tree       
Reading state information... Done
cuda is already the newest version.

ls /usr/local/cuda*
ls: cannot access /usr/local/cuda*: No such file or directory

It also does not find nvcc.

nvcc
The program 'nvcc' is currently not installed. You can install it by typing:
sudo apt-get install nvidia-cuda-toolkit

sudo find /usr/ -name nvcc
<no output>

What is wrong?

5
  • Try sudo find / -name nvcc. If that turns up nothing, then the simple fact is that CUDA did not get installed on your computer. In that case, I would suggest starting over with a clean OS load of Ubuntu 14.04 and repeat the install steps from the guide you linked. Commented Mar 29, 2016 at 14:01
  • 2
    dpkg -L cuda will show you where all the files installed by that package are located. This is much more a Ubuntu package management question than anything to do with CUDA, and I have voted to close it as such
    – talonmies
    Commented Mar 29, 2016 at 14:03
  • 15
    @RobertCrovella, A clean OS load of Ubuntu? are you kidding me?
    – krips89
    Commented Mar 29, 2016 at 16:53
  • @talonmies, I think it is something with the package of cuda. The latest one probably do not have cuda toolkit files in them. Trying to install through runfile as described in the answer solved the problem.
    – krips89
    Commented Mar 29, 2016 at 17:02
  • For any arch users seeing this post, if you installed(using pacman )cuda or cuda-tools, then nvcc is present in /opt/cuda/bin. Add that to your $PATH to use nvcc easily.
    – Jdeep
    Commented Oct 21, 2021 at 15:08

5 Answers 5

68

Usually, it is /usr/local/cuda. If this is not the case, you can try to locate cuda. If you want to find directories only, run

locate cuda | grep /cuda$

or

find / -type d -name cuda 2>/dev/null

For me, it turned out to be in /opt/cuda-7.5

2
  • 7
    locate cuda | grep /cuda$ also give me a lot of not relevant paths.
    – mrgloom
    Commented Nov 29, 2018 at 19:31
  • 5
    find / -type d -name cuda 2>/dev/null also gave a lot of non-relevant paths, but the first 2 were relevant. This command also worked for me on an HPC where I loaded cuda by module
    – mikey
    Commented Apr 9, 2020 at 18:02
27

I tracked the CUDA installation folder to /usr/lib/nvidia-cuda-toolkit. How? I used locate nvcc.

I had installed NVIDIA driver using the Software and Updates --> Additional Drivers followed by CUDA Toolkit installation using sudo apt install nvidia-cuda-toolkit on Ubuntu 20.04. nvcc --version was working fine but when it came to verifying cuDNN installation (https://docs.nvidia.com/deeplearning/cudnn/install-guide/index.html#verify), it was looking for the usr/local/cuda folder and failed.

I, therefore, created a symlink usr/local/cuda to /usr/lib/nvidia-cuda-toolkit as so: ln -s /usr/lib/nvidia-cuda-toolkit/ /usr/local/cuda.

Also added /usr/lib/nvidia-cuda-toolkit/libdevice to $LD_LIBRARY_PATH and /usr/lib/nvidia-cuda-toolkit/bin to$PATH variables.

All is working fine now.

1
  • Thanks for your comment. And apologies for my ignorance! Would you be so kind to provide more details on how to achieve: "Also added /usr/lib/nvidia-cuda-toolkit/libdevice to $LD_LIBRARY_PATH and /usr/lib/nvidia-cuda-toolkit/bin to$PATH variables."? Commented Nov 8, 2022 at 13:15
15

I solved (ditched actually) the problem by using 'Runfile method' for installing. I could get the latest nvidia driver installed with the package method explained above, but the problem seemed to be the cuda toolkit.

Installing the driver through Runfile is pain. So, at the prompt I chose to install just 'cuda toolkit 7.5' and all the files got copied to /usr/local/cuda* directory properly.

2
  • 1
    What is the runfile method of installation? I also have the same problem. Commented Jul 22, 2017 at 11:08
  • There are two ways of installing cuda according to their documentation, package manager method (by the apt-get method in the question), and run file method. Take a look at the installation documentation for cuda of your version.
    – krips89
    Commented Jul 24, 2017 at 13:40
3

just run following command:

which nvcc
0

I had the same issue when upgrading to cuda 8.0. I solved it by changing the nvidia driver back to X.Org and then reinstall it from software& updates. You might want to delete old cuda files as well. I was able to reinstall cuda correctly after this.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.