Nvcc -v fails but CUDA 7.0 installed and nvcc present

I have installed CUDA 7.0 and run deviceQuery from the samples - it passes. If I go to usr/local/CUDA-7.0/bin I can see nvcc is present.

To set the paths, I have run these from the terminal:

export PATH=/usr/local/cuda-7.0/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-7.0/lib64:$LD_LIBRARY_PATH

I have also tried adding these to the bashrc file. However, when I run a Theano test, I get the following error:

ERROR (theano.sandbox.cuda): nvcc compiler not found on $PATH. Check your nvcc installation and try again.

Furthermore, when I run:

nvcc -v 

I get the error:

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

What am I doing wrong? Thank you.


Solution 1:

After I added the following to the theanorc file:

[cuda] 
root = /usr/local/cuda-7.0

CUDA started working as expected. CUDA samples run correctly and Theano tests also run as expected, using the GPU.

nvcc -V also works and produces the following:

Nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2015 NVIDIA Corporation
Built on Mon_Feb_16_22:59:02_CST_2015
Cuda compilation tools, release 7.0, V7.0.27

This stumped me for a while. Note that the V must be uppercase. I was using nvcc -v, which produces an error.

Solution 2:

Unlike @Chis_Parry, I already had the [cuda] flag setup, I managed to solve the problem by refreshing the shared libs cache using:

sudo ldconfig /usr/local/cuda-7.0/lib64

I hope this helps someone in a similar situation I was in.