2

I have just followed this tutorial on installing Tensorflow from source on Ubuntu 16.04, for Python 3.5 with full CUDA and GPU support on an Nvidia graphics cards. The installation was successful.

I am unable to import Tensorflow in a Python session.

Here is the terminal output:

user@user:~/Downloads/tensorflow$ python3.5
Python 3.5.2 (default, Nov 17 2016, 17:05:23) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
Traceback (most recent call last):
  File "/home/user/Downloads/tensorflow/tensorflow/python/pywrap_tensorflow.py", line 41, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
ImportError: No module named 'tensorflow.python.pywrap_tensorflow_internal'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/user/Downloads/tensorflow/tensorflow/__init__.py", line 24, in <module>
    from tensorflow.python import *
  File "/home/user/Downloads/tensorflow/tensorflow/python/__init__.py", line 51, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "/home/user/Downloads/tensorflow/tensorflow/python/pywrap_tensorflow.py", line 52, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "/home/user/Downloads/tensorflow/tensorflow/python/pywrap_tensorflow.py", line 41, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
ImportError: No module named 'tensorflow.python.pywrap_tensorflow_internal'


Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/install_sources#common_installation_problems

for some common reasons and solutions.  Include the entire stack trace
above this error message when asking for help.
talonmies
  • 70,661
  • 34
  • 192
  • 269
n1k31t4
  • 2,745
  • 2
  • 24
  • 38
  • I find this (https://stackoverflow.com/questions/43577923/cannot-import-tensorflow-for-gpu-on-windows-10) helpful. – zhezh Jun 04 '17 at 08:08

2 Answers2

2

I found the cause of the issue here, which is very trivial and so easy to overlook. It is also mentioned in the tutorial now.

One must simply move into another directory, i.e. out of the folder where all downloaded files especially the where the Git repository is stored.

I found this solution mentioned as a comment in a bug on Github.

n1k31t4
  • 2,745
  • 2
  • 24
  • 38
-1

If you use TF1.2.0rc2 and CUDNN 6.0 on Windows, creating a copy of cudnn64_6.dll named cudnn64_5.dll, does the thing.