【问题标题】:TensorFlow 1.3 GPU version not working on Windows 7TensorFlow 1.3 GPU 版本无法在 Windows 7 上运行
【发布时间】:2017-08-18 03:22:05
【问题描述】:

我是机器学习的初学者,正在尝试使用 Anaconda 设置 TensorFlow python 环境。但是,我一直在处理“没有名为“pywrap_tensorflow_internal”的模块”的常见问题

>>> import tensorflow as tf
Traceback (most recent call last):
  File "C:\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_
tensorflow_internal.py", line 18, in swig_import_helper
    return importlib.import_module(mname)
  File "C:\Anaconda3\envs\tensorflow\lib\importlib\__init__.py", line 126, in im
port_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 985, in _gcd_import
  File "<frozen importlib._bootstrap>", line 968, in _find_and_load
  File "<frozen importlib._bootstrap>", line 957, 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 938, 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:\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_
tensorflow.py", line 41, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "C:\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_
tensorflow_internal.py", line 21, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "C:\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_
tensorflow_internal.py", line 20, in swig_import_helper
    return importlib.import_module('_pywrap_tensorflow_internal')
  File "C:\Anaconda3\envs\tensorflow\lib\importlib\__init__.py", line 126, in im
port_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 "<stdin>", line 1, in <module>
  File "C:\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\__init__.py",
line 24, in <module>
    from tensorflow.python import *
  File "C:\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\__init_
_.py", line 49, in <module>
    from tensorflow.python import pywrap_tensorflow
  File "C:\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_
tensorflow.py", line 52, in <module>
    raise ImportError(msg)
ImportError: Traceback (most recent call last):
  File "C:\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_
tensorflow_internal.py", line 18, in swig_import_helper
    return importlib.import_module(mname)
  File "C:\Anaconda3\envs\tensorflow\lib\importlib\__init__.py", line 126, in im
port_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 985, in _gcd_import
  File "<frozen importlib._bootstrap>", line 968, in _find_and_load
  File "<frozen importlib._bootstrap>", line 957, 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 938, 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:\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_
tensorflow.py", line 41, in <module>
    from tensorflow.python.pywrap_tensorflow_internal import *
  File "C:\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_
tensorflow_internal.py", line 21, in <module>
    _pywrap_tensorflow_internal = swig_import_helper()
  File "C:\Anaconda3\envs\tensorflow\lib\site-packages\tensorflow\python\pywrap_
tensorflow_internal.py", line 20, in swig_import_helper
    return importlib.import_module('_pywrap_tensorflow_internal')
  File "C:\Anaconda3\envs\tensorflow\lib\importlib\__init__.py", line 126, in im
port_module
    return _bootstrap._gcd_import(name[level:], package, level)
ImportError: No module named '_pywrap_tensorflow_internal'

尽管这与存在的许多其他问题存在相同的错误,但似乎没有一个解决方案有效。 我在我的%PATH% 中安装并指向了MSVCP140.DLL,并且我在Python 3.5 上运行它。我认为问题出在 CUDA 内部,因为当我运行 CPU 版本的 TensorFlow 时不会出现此问题

但是,我很难弄清楚我的 CUDA 设置出了什么问题。我安装了 CUDA 8 和 cuDNN v5.1。 Here is what my CUDA install folder looks like. cuDNN is just the files extracted from the cuDNN zip.

另外,这里是我的%PATH%的相关部分:

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\cudaNN\bin\cudnn64_5.dll;
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\cudaNN\include\cudnn.h;
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\cudaNN\lib\x64\cudnn.lib;
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\lib;
C:\Windows\System32\msvcp140.dll;
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\lib;
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\extras\CUPTI\libx64;
C:\Windows\SysWOW64\msvcp140.dll;
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA;
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin;
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\libnvvp;

我完全不知道我的设置出了什么问题,因此我们将不胜感激。

【问题讨论】:

    标签: python tensorflow windows-7 tensorflow-gpu


    【解决方案1】:

    如果您安装了 GPU 版本的 TensorFlow 1.3(昨天发布),发布的 PIP 包需要 cuDNN 6。您可以从NVIDIA's website 安装它。确保包含文件cudnn64_6.dll 的目录包含在您的%PATH% 环境变量中。

    【讨论】:

    • 有趣的是,tensorflow 手册说只使用 cuDNN 5.1,但我会尝试在全新安装时使用 cuDNN 6。我希望这有效
    • 确实,TF 1.3 的手册有一个错误,我有一个pull request 来修复它。 TF 1.3 release notes 提到了在预构建的二进制文件中使用 cuDNN 6 的变化。
    • 更新:这有效!非常感谢你的帮助。我想知道为什么安装说明说要使用不起作用的 cuDNN 版本?
    • 感谢我搜索了几个小时但无法正常工作
    猜你喜欢
    • 2018-04-12
    • 2012-06-10
    • 1970-01-01
    • 2018-12-16
    • 1970-01-01
    • 2012-08-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多