1

I've been using tensorflow for a couple of days running on the CPU, but I decided to start using the GPU instead. So, I installed CUDA and tensorflow-gpu via pip, but it didn't work, so I uninstalled both versions of tensorflow, and installed tensorflow-gpu again. The following message appeared:

Traceback (most recent call last):
File "C:\Python35\lib\site-
packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in 
swig_import_helper
return importlib.import_module(mname)
File "C:\Python35\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
File "<frozen importlib._bootstrap>", line 577, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 906, in create_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
ImportError: DLL load failed: The specified module could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Python35\lib\site-
packages\tensorflow\python\pywrap_tensorflow.py", line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Python35\lib\site-
packages\tensorflow\python\pywrap_tensorflow_internal.py", line 21, in 
<module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Python35\lib\site-
packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in 
swig_import_helper
return importlib.import_module('_pywrap_tensorflow_internal')
File "C:\Python35\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: No module named '_pywrap_tensorflow_internal'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "hello.py", line 1, in <module>
import tensorflow as tf
File "C:\Python35\lib\site-packages\tensorflow\__init__.py", line 24, in 
<module>
from tensorflow.python import *
File "C:\Python35\lib\site-packages\tensorflow\python\__init__.py", line 51, 
in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", 
line 52, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Python35\lib\site-
packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in 
swig_import_helper
return importlib.import_module(mname)
File "C:\Python35\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
File "<frozen importlib._bootstrap>", line 577, in module_from_spec
File "<frozen importlib._bootstrap_external>", line 906, in create_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
ImportError: DLL load failed: The specified module could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", 
line 41, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Python35\lib\site-
packages\tensorflow\python\pywrap_tensorflow_internal.py", line 21, in 
<module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Python35\lib\site-
packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in 
swig_import_helper
return importlib.import_module('_pywrap_tensorflow_internal')
File "C:\Python35\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: No module named '_pywrap_tensorflow_internal'


Failed to load the native TensorFlow runtime.

Anyone encoutered similar error before?

talonmies
  • 70,661
  • 34
  • 192
  • 269

2 Answers2

1
  1. CUDNN might be one of the reasons. cuDNN v6.0 does not work for many people. Try with cuDNN v5.1. What is the version of cuDNN you are using ??

  2. Importing from inside GIT folder is also one of the reasons.

Harsha Pokkalla
  • 1,792
  • 1
  • 12
  • 17
  • Thank you! cuDNN was the reason. I didn't install it at all. I thought it was being installed with CUDA 8.0. So, now I installed v5.1 and it displays some warnings, but then it works. – Sebastian Johansson May 12 '17 at 17:02
0

I recommend you to install both CPU and GPU versions in separate virtual environments. You can use python's inbuilt virtual environment or my preference would be anaconda. Keeping both versions independent from each other should solve the problem.