Programing/Python programming

Tensorflow-gpu No module named '_pywrap_tensorflow' 에러

sosal 2017. 9. 30. 20:42
반응형

return _bootstrap._gcd_import(name[level:], package, level)
File "", line 986, in _gcd_import
File "", line 969, in _find_and_load
File "", line 958, in _find_and_load_unlocked
File "", line 666, in _load_unlocked
File "", line 577, in module_from_spec
File "", line 906, in create_module
File "", line 222, in _call_with_frames_removed
ImportError: DLL load failed: Impossibile trovare il modulo specificato.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users\Utente\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python_init_.py", line 66, in 
from tensorflow.python import pywrap_tensorflow
File "C:\Users\Utente\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 21, in 
_pywrap_tensorflow = swig_import_helper()
File "C:\Users\Utente\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 20, in swig_import_helper
return importlib.import_module('pywrap_tensorflow')
File "C:\Users\Utente\AppData\Local\Programs\Python\Python35\lib\importlib_init
.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
ImportError: No module named '_pywrap_tensorflow'


분명히 NVIDIA CUDA, CUDA toolkit, 다 설치한 것 같은데

DLL이 없다며, "_pywrap_tensorflow" 라는 무책임한 에러를 던져준다.

도대체 어떤 DLL이 없단는걸까.. 헤맸지만, 다행히 구글링해보니 비슷한 처지인 사람들이 많았다.

https://github.com/tensorflow/tensorflow/issues/7623



답은 CMD 창에서, tensorflow에 필요할만한 DLL이 있는지 하나하나 확인해보는것이다.


where KERNEL32.dll

where WSOCK32.dll

where WS2_32.dll

where SHLWAPI.dll

where nvcuda.dll

where cublas64_80.dll

where cufft64_80.dll

where curand64_80.dll

where cudnn64_6.dll

where python36.dll

where MSVCP140.dll

where VCRUNTIME140.dll


--------------------------------------------------------------------------------------------------------

C:\Users\Lee>where cudnn64_6.dll

정보: 제공된 패턴에 해당되는 파일을 찾지 못했습니다.

--------------------------------------------------------------------------------------------------------


결국 범인은 cudnn64_6.dll 이었다는것..

설치를 CUDA 8.0 / cudnn 5.1로 했었는데, cudnn64_6.dll은 cudnn 6버전에서 다운받을 수 있었다.



MSVCP140.dll 에 문제가 있는 경우도 잦다는데,

그럴 경우 'Microsoft Visual C++ 2015 Redistributable Update 3' 업데이트를 해주면 된다.

https://www.microsoft.com/en-us/download/details.aspx?id=53587