简体   繁体   中英

Installing Tensorflow GPU on Win 8 :

I am trying to install Tensorflow gpu (for Keras) with Anaconda 4.2 for days.

My last attempt was following this tutorial : https://sites.google.com/site/ivanhuertacasado/installing-keras-theano-tensorflow-with-gpu-windows

I don't intend to use theano, only tensorflow-gpu.

My specs are the following :

  • Windows 8.1, 64 bits
  • Geforce GTX 860M (for notebook)
  • I tried all version of Cudnn, from 5 to 7 with Cuda 8 and 9 (almost).

All the time, I get the same error when I try "import tensorflow", as you can find here :

Using TensorFlow backend.
Traceback (most recent call last):
  File "E:\Users\user\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tenso
rflow_internal.py", line 18, in swig_import_helper
    return importlib.import_module(mname)
  File "E:\Users\user\Anaconda3\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: Le module spécifié est introuvable.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "E:\Users\user\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tenso
rflow.py", line 41, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "E:\Users\user\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tenso
rflow_internal.py", line 21, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "E:\Users\user\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tenso
rflow_internal.py", line 20, in swig_import_helper
    return importlib.import_module('_pywrap_tensorflow_internal')
  File "E:\Users\user\Anaconda3\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 "cifar10_cnn.py", line 11, in <module>
    import keras
  File "E:\Users\user\Anaconda3\lib\site-packages\keras\__init__.py", line 3, in
 <module>
    from . import utils
  File "E:\Users\user\Anaconda3\lib\site-packages\keras\utils\__init__.py", line
 6, in <module>
    from . import conv_utils
  File "E:\Users\user\Anaconda3\lib\site-packages\keras\utils\conv_utils.py", li
ne 3, in <module>
    from .. import backend as K
  File "E:\Users\user\Anaconda3\lib\site-packages\keras\backend\__init__.py", li
ne 83, in <module>
    from .tensorflow_backend import *
  File "E:\Users\user\Anaconda3\lib\site-packages\keras\backend\tensorflow_backe
nd.py", line 1, in <module>
    import tensorflow as tf
  File "E:\Users\user\Anaconda3\lib\site-packages\tensorflow\__init__.py", line
24, in <module>
    from tensorflow.python import *
  File "E:\Users\user\Anaconda3\lib\site-packages\tensorflow\python\__init__.py"
, line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "E:\Users\user\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tenso
rflow.py", line 52, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "E:\Users\user\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tenso
rflow_internal.py", line 18, in swig_import_helper
    return importlib.import_module(mname)
  File "E:\Users\user\Anaconda3\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: Le module spécifié est introuvable.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "E:\Users\user\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tenso
rflow.py", line 41, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "E:\Users\user\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tenso
rflow_internal.py", line 21, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "E:\Users\user\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tenso
rflow_internal.py", line 20, in swig_import_helper
    return importlib.import_module('_pywrap_tensorflow_internal')
  File "E:\Users\user\Anaconda3\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.

See https://www.tensorflow.org/install/install_sources#common_installation_probl
ems

for some common reasons and solutions.  Include the entire stack trace
above this error message when asking for help.

The Cpu test works well, but can't find how to work with the gpu.

I have been searching and here is the list of what I can say I tried :

  • Checking System32, if there is MSVCP140.DLL. There is the Dll. I cannot install VC++ redistribuable 2015 since there is already the 2017 version on my computer. And I uninstalled/installed it again to check.
  • I set %CUDA_HOME% as C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA
  • I set %CUDA_PATH% as C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v8.0
  • I added the .DLL extension to the %PATH_EXT%
  • %PATH% targets to C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v8.0\\bin
  • All the time, I move the Cudnn to their respective Cuda folder (bin/includes/...)
  • In the CMD, cudnn64_5.dll is found correctly (no matter in which directory I am, the cmd finds it).
  • My GeForce Game Ready Driver is up to date
  • I was not able to get the GPU working with Theano

    ERROR (theano.sandbox.cuda): Failed to compile cuda_ndarray.cu: ('nvcc return st atus', 255, 'for cmd', 'nvcc -shared -O3 --compiler-bindir E:\\Program Files (x8 6)\\Microsoft Visual Studio\\2017\\Community\\VC -Xlinker /DEBUG -D HAVE_ROUND - m64 -Xcompiler -DCUDA_NDARRAY_CUH=mc72d035fdf91890f3b36710688069b2e,-DNPY_NO_DEP RECATED_API=NPY_1_7_API_VERSION,/Zi,/MD -I"E:\\Users\\user\\Anaconda3\\lib\\site -packages\\theano\\sandbox\\cuda" -I"E:\\Users\\user\\Anaconda3\\lib\\site-packa ges\\numpy\\core\\include" -I"E:\\Users\\user\\Anaconda3\\include" -I"E:\\Users\\ \\user\\Anaconda3\\lib\\site-packages\\theano\\gof" -L"E:\\Users\\user\\Anaconda3 \\libs" -L"E:\\Users\\user\\Anaconda3" -o C:\\Users\\user\\AppData\\Local\\Thean o\\compiledir_Windows-8.1-6.3.9600-SP0-Intel64_Family_6_Model_60_Stepping_3_Genu ineIntel-3.5.2-64\\cuda_ndarray\\cuda_ndarray.pyd mod.cu -lcublas -lpython35 -lc udart') WARNING (theano.sandbox.cuda): The cuda backend is deprecated and will be remove d in the next release (v0.10). Please switch to the gpuarray backend. You can g et more information about how to switch at this URL: https://github.com/Theano/Theano/wiki/Converting-to-the-new-gpu-back-end%28gpua rray%29

    WARNING (theano.sandbox.cuda): CUDA is installed, but device gpu is not availabl e (error: cuda unavailable) forrtl: error (200): program aborting due to control-C event Image PC Routine Line Source

    libifcoremd.dll 00007FFA853843E4 Unknown Unknown Unknown KERNELBASE.dll 00007FFAB27CD37F Unknown Unknown Unknown KERNEL32.DLL 00007FFAB44413D2 Unknown Unknown Unknown ntdll.dll 00007FFAB54854E4 Unknown Unknown Unknown

  • Cuda works properly in the Sample provided by nvidia

  • Nvcc --version returns the following :

    C:\\Users\\user\u0026gt;nvcc --version nvcc: NVIDIA (R) Cuda compiler driver Copyright (c) 2005-2016 NVIDIA Corporation Built on Mon_Jan__9_17:32:33_CST_2017 Cuda compilation tools, release 8.0, V8.0.60

Has anybody any idea ?

Ok, so I could fix the issue.

The problem came from Visual Studio 2017.

I uninstalled all version of Cuda (and the CDNN). I uninstalled VS 2017 and all redistrib data

I installed VS 2015 : I installed Cuda 8.0 I installed in the cuda folder the CuDnn 5.1, then the CuDnn 6.0 (I replaced when necessary)

Thus, my problem was fixed. Hope it my help any people.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM