本文介绍了导入具有GPU支持的TensorFlow时DLL加载失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试在Windows 10上安装具有GPU支持的TensorFlow,但导入时出现错误(如下所示).CPU版本工作正常.
I am trying to install TensorFlow with GPU support on Windows 10, but I get an error (shown below) when importing it. The CPU version works fine.
我有
- 通过pip安装了
tensorflow-gpu
- 通过GeForce Experience更新了我的GTX 1050的NVidia驱动程序
- 使用NVidia的网络安装程序安装了CUDA 10.1
- 已安装cuDNN 7.5.0.56,复制正确的CUDA文件夹中的每个文件
- 已安装TensorRT 5.1.2.2通过zip方法,并再次在CUDA中复制了相关的DLL
- installed
tensorflow-gpu
through pip - updated the NVidia drivers for my GTX 1050 with GeForce Experience
- installed CUDA 10.1 with NVidia's network installer
- installed cuDNN 7.5.0.56, taking care of copying every file in the right CUDA folder
- installed TensorRT 5.1.2.2 via the zip method and copied the relevant DLLs in CUDA again
这是错误:
> python
Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 23:09:28) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\imp.py", line 342, in load_dynamic
return _load(spec)
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 "<stdin>", line 1, in <module>
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\__init__.py", line 24, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "C:\Users\user\AppData\Local\Programs\Python\Python37\lib\imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: DLL load failed: The specified module could not be found.
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/errors
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
我的PATH环境变量(我删除了所有非Microsoft和非NVidia条目):
My PATH environment variable (I removed all non-Microsoft and non-NVidia entries):
> echo $env:PATH.Split(';')
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\libnvvp
C:\Program Files\Microsoft MPI\Bin\
C:\WINDOWS\system32
C:\WINDOWS
C:\WINDOWS\System32\Wbem
C:\WINDOWS\System32\WindowsPowerShell\v1.0\
C:\WINDOWS\System32\OpenSSH\
C:\Program Files\Microsoft SQL Server\130\Tools\Binn\
C:\Program Files\dotnet\
C:\Program Files (x86)\dotnet\
C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common
C:\Program Files\NVIDIA Corporation\Nsight Compute 2019.1\
C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\extras\CUPTI\lib64
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\include
C:\Program Files\TensorRT-5.1.2.2\lib
C:\Program Files\TensorRT-5.1.2.2\bin
C:\tools\cuda\bin
TensorRT安装在 C:\ Program Files \ TensorRT-5.1.2.2
中.
TensorRT is installed in C:\Program Files\TensorRT-5.1.2.2
.
CUDA bin
文件夹的内容:
Content of the CUDA bin
folder:
PS C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin> ls
Directory: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 18/04/2019 12:39 crt
-a---- 09/02/2019 06:57 202752 bin2c.exe
-a---- 09/02/2019 06:57 74850816 cublas64_10.dll
-a---- 09/02/2019 06:57 36055552 cublasLt64_10.dll
-a---- 09/02/2019 06:57 374272 cuda-memcheck.exe
-a---- 09/02/2019 06:57 4320256 cudafe++.exe
-a---- 09/02/2019 06:57 339968 cudart32_101.dll
-a---- 09/02/2019 06:57 408064 cudart64_101.dll
-a---- 18/04/2019 15:19 392566784 cudnn64_7.dll
-a---- 09/02/2019 06:57 115644416 cufft64_10.dll
-a---- 09/02/2019 06:57 225792 cufftw64_10.dll
-a---- 09/02/2019 06:57 4785664 cuinj64_101.dll
-a---- 09/02/2019 06:57 2074624 cuobjdump.exe
-a---- 09/02/2019 06:57 49030656 curand64_10.dll
-a---- 09/02/2019 06:57 171052032 cusolver64_10.dll
-a---- 09/02/2019 06:57 87930368 cusparse64_10.dll
-a---- 09/02/2019 06:57 285184 fatbinary.exe
-a---- 09/02/2019 06:57 1323008 gpu-library-advisor.exe
-a---- 09/02/2019 06:57 233472 nppc64_10.dll
-a---- 09/02/2019 06:57 10049024 nppial64_10.dll
-a---- 09/02/2019 06:57 3719680 nppicc64_10.dll
-a---- 09/02/2019 06:57 1003008 nppicom64_10.dll
-a---- 09/02/2019 06:57 7227904 nppidei64_10.dll
-a---- 09/02/2019 06:57 46016512 nppif64_10.dll
-a---- 09/02/2019 06:57 24603136 nppig64_10.dll
-a---- 09/02/2019 06:57 5848064 nppim64_10.dll
-a---- 09/02/2019 06:57 17426944 nppist64_10.dll
-a---- 09/02/2019 06:57 194560 nppisu64_10.dll
-a---- 09/02/2019 06:57 2610688 nppitc64_10.dll
-a---- 09/02/2019 06:57 8202240 npps64_10.dll
-a---- 09/02/2019 06:57 247296 nvblas64_10.dll
-a---- 09/02/2019 06:57 384000 nvcc.exe
-a---- 09/02/2019 06:57 310 nvcc.profile
-a---- 09/02/2019 06:57 22919168 nvdisasm.exe
-a---- 09/02/2019 06:57 149298688 nvgraph64_10.dll
-a---- 18/04/2019 16:46 131539456 nvinfer.dll
-a---- 18/04/2019 16:46 3663360 nvinfer_plugin.dll
-a---- 09/02/2019 06:57 5960192 nvlink.exe
-a---- 18/04/2019 16:46 4457472 nvonnxparser.dll
-a---- 18/04/2019 16:46 2447872 nvparsers.dll
-a---- 09/02/2019 06:57 4243456 nvprof.exe
-a---- 09/02/2019 06:57 221696 nvprune.exe
-a---- 09/02/2019 06:57 4580352 nvrtc-builtins64_101.dll
-a---- 09/02/2019 06:57 15659520 nvrtc64_101_0.dll
-a---- 09/02/2019 06:57 53 nvvp.bat
-a---- 09/02/2019 06:57 5838336 ptxas.exe
以及 C:\ tools
:
PS C:\tools> tree /F
Folder PATH listing
Volume serial number is 6A54-3EA7
C:.
└───cuda
│ NVIDIA_SLA_cuDNN_Support.txt
│
├───bin
│ cudnn64_7.dll
│
├───include
│ cudnn.h
│
└───lib
└───x64
cudnn.lib
推荐答案
问题是我安装了CUDA 10.1而不是10.0.TensorFlow尚未与10.1兼容.
The problem was that I installed CUDA 10.1 instead of 10.0. TensorFlow isn't yet compatible with 10.1.
这篇关于导入具有GPU支持的TensorFlow时DLL加载失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!