2017-08-18 2 views
1

Ich bin ein Anfänger zum maschinellen Lernen und versuche, eine TensorFlow Python-Umgebung mit Anaconda einzurichten. Allerdings habe ich mit dem gemeinsamen Problem der „No-Modul namens‚pywrap_tensorflow_internal‘“TensorFlow 1.3 GPU-Version funktioniert nicht unter Windows 7

>>> 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' 

Trotzdem ist der gleiche Fehler wie so viele andere Fragen vorhanden, keine der Lösungen scheinen zu tun zu arbeiten. Ich habe MSVCP140.DLL installiert und zeigte auf meine %PATH% und ich führe dies auf Python 3.5. Ich glaube, dass das Problem innerhalb der CUDA liegt, da dieses Problem nicht auftritt, wenn ich die CPU-Version von TensorFlow starte. Allerdings hatte ich Schwierigkeiten, herauszufinden, was mit meiner CUDA-Konfiguration nicht stimmt. Ich habe CUDA 8 und cuDNN v5.1 installiert. Here is what my CUDA install folder looks like. cuDNN is just the files extracted from the cuDNN zip.

Außerdem sind hier die relevanten Teile meines meine %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; 

Ich habe absolut keine Ahnung, was mit meinem Setup falsch ist, so dass jede Hilfe würde sehr geschätzt werden.

Antwort

4

Wenn Sie die GPU-Version von TensorFlow 1.3 installiert ist (die gestern veröffentlicht wurde), das freigesetzte PIP-Paket erfordert cuDNN 6. Sie können es von NVIDIA's website installieren. Stellen Sie sicher, dass das Verzeichnis mit der Datei cudnn64_6.dll in Ihrer Umgebungsvariablen %PATH% enthalten ist.

+0

Interessant, das Tensorflow-Handbuch sagte, nur cuDNN 5.1 zu verwenden, aber ich werde cuDNN 6 auf einer neuen Installation ausprobieren. Ich hoffe, das funktioniert – Lexinyaas

+0

In der Tat hat das Handbuch für TF 1.3 einen Fehler darin, und ich habe eine [Pull-Anfrage] (https://github.com/tensorflow/tensorflow/pull/12383) aus, um es zu beheben. Die [TF 1.3 Release Notes] (https://github.com/tensorflow/tensorflow/releases/tag/v1.3.0) erwähnen die Änderung der Verwendung von cuDNN 6 in vordefinierten Binärdateien. – mrry

+0

Update: das hat funktioniert! Vielen Dank für die Hilfe. Ich frage mich, warum die Installationsanweisungen eine Version von cuDNN verwenden, die nicht funktioniert hat? – Lexinyaas

Verwandte Themen