[PYTHON] Solve the problem of missing libcudart in Ubuntu 16.04 + CUDA 8.0 + Tensorflow environment

I was able to use Ubuntu 16.04 + GTX1080 + Tensorflow v0.10, but suddenly I got the following error.

>>> import tensorflow as tf
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/val/.pyenv/versions/anaconda3-4.1.1/envs/tensorflow/lib/python3.5/site-packages/tensorflow/__init__.py", line 23, in <module>
    from tensorflow.python import *
  File "/home/val/.pyenv/versions/anaconda3-4.1.1/envs/tensorflow/lib/python3.5/site-packages/tensorflow/python/__init__.py", line 48, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "/home/val/.pyenv/versions/anaconda3-4.1.1/envs/tensorflow/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow.py", line 28, in <module>
    _pywrap_tensorflow = swig_import_helper()
  File "/home/val/.pyenv/versions/anaconda3-4.1.1/envs/tensorflow/lib/python3.5/site-packages/tensorflow/python/pywrap_tensorflow.py", line 24, in swig_import_helper
    _mod = imp.load_module('_pywrap_tensorflow', fp, pathname, description)
  File "/home/val/.pyenv/versions/anaconda3-4.1.1/envs/tensorflow/lib/python3.5/imp.py", line 242, in load_module
    return load_dynamic(name, filename, file)
  File "/home/val/.pyenv/versions/anaconda3-4.1.1/envs/tensorflow/lib/python3.5/imp.py", line 342, in load_dynamic
    return _load(spec)
ImportError: libcudart.so.7.5: cannot open shared object file: No such file or directory

It was working with CUDA 8.0 installed (that is, CUDA 7.5 was not installed), but it was a mystery why I suddenly wanted 7.5 libcudart. ..

I was in trouble and tried various things, but no. I thought it was necessary to reinstall Tensorflow, and when I looked at Anaconda install on the official page (https://www.tensorflow.org/versions/r0.10/get_started/os_setup.html), it was certainly v0.10. Comments require CUDA 7.5.

# Ubuntu/Linux 64-bit, GPU enabled, Python 3.5
# Requires CUDA toolkit 7.5 and CuDNN v5. For other versions, see "Install from sources" below.
$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.10.0-cp35-cp35m-linux_x86_64.whl

So, since r0.11 was released, when I looked at it, the comment changed and it says that CUDA toolkit 8.0 is required. After seeing this, I took the plunge and updated to v.0.11.

 Ubuntu/Linux 64-bit, GPU enabled, Python 3.5
# Requires CUDA toolkit 8.0 and CuDNN v5. For other versions, see "Install from sources" below.
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow-0.11.0-cp35-cp35m-linux_x86_64.whl
# Python 3
(tensorflow)$ pip3 install --ignore-installed --upgrade $TF_BINARY_URL

When I run it with source activate, it succeeds!

>>> import tensorflow as tf
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcublas.so locally
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcudnn.so locally
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcufft.so locally
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:111] successfully opened CUDA library libcurand.so locally

So, for those who have CUDA 8.0 installed, it seems better to use r0.11 or higher.

Recommended Posts

Solve the problem of missing libcudart in Ubuntu 16.04 + CUDA 8.0 + Tensorflow environment
How to handle multiple versions of CUDA in the same environment
Using TensorFlow in the cloud integrated development environment Cloud9 ~ Basics of usage ~
Solve the maximum subarray problem in Python
[At Coder] Solve the problem of binary search
How to install the deep learning framework Tensorflow 1.0 in the Anaconda environment of Windows
Used from the introduction of Node.js in WSL environment
Operate mongoDB from python in ubuntu environment ① Introduction of mongoDB
The story of building the fastest Linux environment in the world
Check the operation of Python for .NET in each environment
Django + MongoDB development environment maintenance (in the middle of writing)
Resolve a Segmentation fault that occurs in Ubuntu 16.04+ Tensorflow environment
Solve the Japanese problem when using the CSV module in Python.
The story of downgrading the version of tensorflow in the demo of Mask R-CNN.
[Ubuntu 18.04] Tensorflow 2.0.0-GPU environment construction
Solve the Monty Hall problem
Ubuntu14.04 + GPU + TensorFlow environment construction
Django cannot be installed in the development environment of pipenv + pyenv
[Understanding in the figure] Management of Python virtual environment by Pipenv
Environment construction of Tensorflow and Chainer by Window with CUDA (with GPU)
Try to solve the N Queens problem with SA of PyQUBO
[TensorFlow 2] How to check the contents of Tensor in graph mode
Solve the initial value problem of ordinary differential equations with JModelica
Solve the subset sum problem with a full search in Python
Install CUDA10.1 + cuDNN7.6.5 + tensorflow-2.3.0 on Ubuntu 18.04
The story of participating in AtCoder
Change the background of Ubuntu (GNOME)
Summary of various operations in Tensorflow
Solve the delay of interferometer observation
install tensorflow in anaconda + python3.5 environment
The story of the "hole" in the file
The meaning of ".object" in Django
Illustration of the results of the knapsack problem
Environment construction of "Tello_Video" on Ubuntu
Use Raspberry Pi to solve the problem of insufficient mobile Wi-Fi connection
Until the Deep Learning environment (TensorFlow) using GPU is prepared for Ubuntu 14.04