5

I'm trying to install Tensorflow GPU version and I'm stuck at this. I've installed nvidia-cuda-toolkit by running

 sudo apt install nvidia-cuda-toolkit

and it downloaded fine. But i'm unable to locate this libcudart.so

Please specify which gcc nvcc should use as the host compiler. [Default is /usr/bin/gcc]: /usr/bin/gcc
Please specify the Cuda SDK version you want to use, e.g. 7.0. [Leave empty to use system default]: 
Please specify the location where CUDA  toolkit is installed. Refer to README.md for more details. [Default is /usr/local/cuda]: /usr/local/cuda
Invalid path to CUDA  toolkit. /usr/local/cuda/lib64/libcudart.so cannot be found

How can I solve this?

iamgr007
  • 132

3 Answers3

3

It seems that, you have exported wrong path.

So, On terminal type: sudo ldconfig /usr/local/cuda/lib64

ldconfig creates the necessary links and cache to the most recent shared libraries found in the directories specified on the command line

If this don't work try: export PATH=$PATH:/usr/local/cuda/bin This will set environmental path.

Olimjon
  • 7,292
  • this is definitely the right answer. note that the path /usr/local/cuda is potentially optional with some nvidia installers, so if you dont have that path, just use /usr/local/cuda-10.0 – Asad-ullah Khan Aug 16 '19 at 02:34
  • 1
    i don't havef any of these paths – chovy Jan 25 '21 at 04:30
3

Not sure if it is the best way but I had the same issue and this helped.

sudo ln -s /usr/local/cuda/lib64 /usr

Verify the link from /usr with ls -l lib64

lib64 -> /usr/local/cuda/lib64

Sildeag
  • 153
1

If you're using Ubuntu 16.04 or Ubuntu 18.04 and want to get TensorFlow with GPU support installed, there is a deb package for that in the Lambda Stack repository.

You can install the repository and the package with this line:

LAMBDA_REPO=$(mktemp) && \
wget -O${LAMBDA_REPO} https://lambdal.com/static/files/lambda-stack-repo.deb && \
sudo dpkg -i ${LAMBDA_REPO} && rm -f ${LAMBDA_REPO} && \
sudo apt-get update && sudo apt-get install -y lambda-stack-cuda

What it does:

  1. Download and installs the Lambda Stack Repository (essentially adds a file to /etc/apt/sources.list.d/)
  2. Updates apt and installs the lambda-stack-cuda package.
  3. Installs CUDA, Drivers, CuDNN, and TensorFlow with CuDNN and GPU support into the proper system level directories. You won't need to modify your LD_LIBRARY_PATH or PATH as the shared libraries are placed in directories that ld already checks at link time.
sabalaba
  • 191
  • Thanks, I noticed that Lambda Stack doesn't set the the LD_LIBRARY_PATH and CUDA_HOME environment variables. Any reason why the installer doesn't do this? – Gabriel Fair Jan 09 '19 at 13:43
  • It’s because we properly place the library .so files in locations where ‘ld’ already looks. – sabalaba Jan 09 '19 at 15:38