Tensorflow import error "Couldn't open CUDA library libcuda.so.1" Ubuntu 14.04 Cuda 8.0 Dell 7559 i7


I need help regarding installation of Tensorflow on Ubuntu with GPU support .

I have followed a blog on bumblebee+ubuntu on Dell 7559 and it works perfectly fine.

What’s done>>

  1. Ubuntu 14.04 lts +windows 10 dual boot
  2. bumblebee + nvidia 367 drivers
  3. Cuda 8.0 (without packaged nvidia drivers)
  4. cuDNN 5.1
  5. Tensorflow 0.11rc2 with python3

Now its stuck at last step which is when I test TF installation
by typing “import tensorflow as tf” inside python3 console
## it fails to import libcuda.so.1 file at LD library path(which is correctly set)

Some facts:–
ls -l /usr/local/cuda-8.0/lib64/stubs/libcuda.*
-rwxr-xr-x 1 root root 40048 Nov 8 18:46 /usr/local/cuda-8.0/lib64/stubs/libcuda.so

import tensorflow as tf
I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcublas.so.8.0 locally
I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcudnn.so.5 locally
I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcufft.so.8.0 locally
I tensorflow/stream_executor/dso_loader.cc:119] Couldn’t open CUDA library libcuda.so.1. LD_LIBRARY_PATH: :/usr/local/cuda-8.0/lib64:/usr/local/cuda/extras/CUPTI/lib64
I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:165] hostname: airig-Inspiron-7559
I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:189] libcuda reported version is: Not found: was unable to find libcuda.so DSO loaded into this program
I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:363] driver version file contents: “”“NVRM version: NVIDIA UNIX x86_64 Kernel Module 367.57 Mon Oct 3 20:37:01 PDT 2016
GCC version: gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3)
I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:193] kernel reported version is: 367.57.0
I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1091] LD_LIBRARY_PATH: :/usr/local/cuda-8.0/lib64:/usr/local/cuda/extras/CUPTI/lib64
I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:1092] failed to find libcuda.so on this system: Failed precondition: could not dlopen DSO: libcuda.so.1; dlerror: libnvidia-fatbinaryloader.so.367.57: cannot open shared object file: No such file or directory
I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcurand.so.8.0 locally

$ sudo find /usr/ -name ‘libcuda.so.1’

ldconfig -p

libcupsfilters.so.1 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libcupsfilters.so.1
libcupscgi.so.1 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libcupscgi.so.1
libcups.so.2 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libcups.so.2
libcuda.so.1 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libcuda.so.1
libcuda.so.1 (libc6) => /usr/lib/i386-linux-gnu/libcuda.so.1
libcuda.so (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libcuda.so
libcuda.so (libc6) => /usr/lib/i386-linux-gnu/libcuda.so

libcrypto.so.1.0.0 (libc6,x86-64) => /lib/x86_64-linux-gnu/libcrypto.so.1.0.0
libcrypto.so (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libcrypto.so
libcrypt.so.1 (libc6,x86-64, OS ABI: Linux 2.6.24) => /lib/x86_64-linux-gnu/libcrypt.so.1

$ ./deviceQuery
./deviceQuery Starting…

CUDA Device Query (Runtime API) version (CUDART static linking)

cudaGetDeviceCount returned 35
-> CUDA driver version is insufficient for CUDA runtime version
Result = FAIL

Can you please help in locating this file or pointing to tweaks in NVIDIA installation stage.

Thanks in advance

Your cuda install is not done correctly.

If you want to use the GPU in tensorflow, make sure your CUDA install is working first.

Follow the directions in the CUDA install guide, including the verification steps.

Also, stubs/libcuda.so is not hte correct libcuda.so. You can’t use that at runtime, and it should not be the one that is on the search path.

Thanks for a prompt reply.

I have tried installing cuda with Nvidia drivers installed as part of .run package but that breaks my display and am unable to login/ display turns off after restart.

So I skipped nvidia install during Cuda setup, is that the problem?

Am using 367.57 version for my GTX 960m and Cuda 8.0 run package offers 367.48.

How to proceed ahead? Please point in a specific way.

Yes, that’s a problem.

There are many posts already on this forum discussing what to do when the install breaks your display. The specifics will depend on your specific laptop.

If you can use the intel display device only, then you may be able to install the drivers without OpenGL libraries and without modification to your xorg.conf, and it should work.

I suggest you do some research.

The posts which i have followed distinctly specify two steps ::

  1. Build and install Tensorflow. Dont use binaries.
  2. Install latest nvidia drivers from official site and skip cuda suggested drivers.

I still don’t understand what’s the fix because going cuda way display breaks.

Hi Anuj,

I have documented the steps to get CUDA working with Nvidia on an Optimus laptop, using bumblebee.

Refer - http://hemenkapadia.github.io/blog/2016/11/11/Ubuntu-with-Nvidia-CUDA-Bumblebee.html for the same.