在Win 8上安装Tensorflow GPU:

时间:2017-10-13 18:42:22

标签: python tensorflow anaconda

我试图用Anaconda 4.2安装Tensorflow gpu(用于Keras)几天。

我的最后一次尝试是遵循本教程:https://sites.google.com/site/ivanhuertacasado/installing-keras-theano-tensorflow-with-gpu-windows

我不打算使用theano,只有tensorflow-gpu。

我的规格如下:

  • Windows 8.1,64位
  • Geforce GTX 860M(适用于笔记本电脑)
  • 我尝试了所有版本的Cudnn,从5到7,Cuda 8和9(差不多)。

我一直在尝试"导入tensorflow"时遇到同样的错误,你可以在这里找到:

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.

Cpu测试运行良好,但无法找到如何使用gpu。

我一直在搜索,这里是我可以说我试过的名单:

  • 检查System32,是否有MSVCP140.DLL。有Dll。我无法安装VC ++ redistribuable 2015,因为我的计算机上已有2017版本。然后我再次卸载/安装它以进行检查。
  • 我将%CUDA_HOME%设置为C:\ Program Files \ NVIDIA GPU Computing Toolkit \ CUDA
  • 我将%CUDA_PATH%设置为C:\ Program Files \ NVIDIA GPU Computing Toolkit \ CUDA \ v8.0
  • 我将.DLL扩展名添加到%PATH_EXT%
  • %PATH%定位到C:\ Program Files \ NVIDIA GPU Computing Toolkit \ CUDA \ v8.0 \ bin
  • 我一直将Cudnn移动到他们各自的Cuda文件夹(bin / includes /...)
  • 在CMD中,找到了正确的cudnn64_5.dll(无论我在哪个目录中,cmd都会找到它。)
  • 我的GeForce游戏就绪驱动程序是最新的
  • 我无法让GPU使用Theano

    错误(theano.sandbox.cuda):无法编译cuda_ndarray.cu :(&#39; nvcc return st atus&#39;,255,&#39; for cmd&#39;,&#39; 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&#34; E:\ Users \ user \ Anaconda3 \ lib \ site -packages \ theano \沙箱\ CUDA&#34; -I&#34; E:\用户\用户\ Anaconda3 \ lib中\站点帕茨卡 GES \ numpy的\芯\包括&#34; -I&#34; E:\用户\用户\ Anaconda3 \包括&#34; -I&#34; E:\用户\ \用户\ Anaconda3 \ lib中\站点包\ theano \ GOF&#34; -L&#34; E:\用户\用户\ Anaconda3 \库&#34; -L&#34; E:\用户\用户\ Anaconda3&#34; -o C:\ Users \ user \ AppData \ Local \ Thean Ø\ 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&#39;) 警告(theano.sandbox.cuda):cuda后端已弃用,将被删除 d在下一个版本中(v0.10)。请切换到gpuarray后端。你可以克 有关如何切换此URL的更多信息:  https://github.com/Theano/Theano/wiki/Converting-to-the-new-gpu-back-end%28gpua rray%29

    警告(theano.sandbox.cuda):已安装CUDA,但设备gpu不可用 e(错误:cuda不可用) forrtl:error(200):程序由于control-C事件而中止 图像PC例行线源

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

  • Cuda在nvidia提供的样本中正常工作

  • Nvcc --version返回以下内容:

    C:\ Users \ user&gt; nvcc --version nvcc:NVIDIA(R)Cuda编译器驱动程序 版权所有(c)2005-2016 NVIDIA Corporation 建于Mon_Jan__9_17:32:33_CST_2017 Cuda编译工具,8.0版,V8.0.60

有人有任何想法吗?

1 个答案:

答案 0 :(得分:0)

好的,我可以解决这个问题。

问题来自Visual Studio 2017。

我卸载了所有版本的Cuda(和CDNN)。 我卸载了VS 2017和所有重新分发数据

我安装了VS 2015: 我安装了Cuda 8.0 我在cuda文件夹中安装了CuDnn 5.1,然后安装了CuDnn 6.0(我必要时更换)

因此,我的问题得到解决。希望对任何人都有所帮助。