Tensorflow安装在Windows错误上

时间:2016-11-30 14:22:34

标签: windows-installer tensorflow python-3.5

Tensorflow现已在Windows上提供:

 https://developers.googleblog.com/2016/11/tensorflow-0-12-adds-support-for-windows.html

我使用了pip install tensorflow。

我尝试运行介绍代码:

 https://www.tensorflow.org/versions/r0.12/get_started/index.html

我收到此错误:

C:\Python\Python35-32\python.exe "C:/tensorflow_tutorial.py"
Traceback (most recent call last):
  File "C:\Python\Python35-32\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 18, in swig_import_helper
return importlib.import_module(mname)
  File "C:\Python\Python35-32\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 903, in create_module
   File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
 ImportError: DLL load failed: %1 is not a valid Win32 application.

这个网站有一些关于DLL的建议,但是任何人都猜错了:

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

更新:我切换到x64我收到此错误:

I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\dso_loader.cc:119] Couldn't open CUDA library cublas64_80.dll
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\cuda\cuda_blas.cc:2294] Unable to load cuBLAS DSO.
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\dso_loader.cc:119] Couldn't open CUDA library cudnn64_5.dll
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\cuda\cuda_dnn.cc:3459] Unable to load cuDNN DSO
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\dso_loader.cc:119] Couldn't open CUDA library cufft64_80.dll
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\cuda\cuda_fft.cc:344] Unable to load cuFFT DSO.
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\dso_loader.cc:119] Couldn't open CUDA library nvcuda.dll
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\cuda\cuda_diagnostics.cc:165] hostname: ����

UPDATE2:

我安装了nvidia cuda文件

 https://developer.nvidia.com/cuda-downloads

我收到这些错误:

I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\dso_loader.cc:128] successfully opened CUDA library cublas64_80.dll locally
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\dso_loader.cc:119] Couldn't open CUDA library cudnn64_5.dll
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\cuda\cuda_dnn.cc:3459] Unable to load cuDNN DSO
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\dso_loader.cc:128] successfully opened CUDA library cufft64_80.dll locally
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\dso_loader.cc:119] Couldn't open CUDA library nvcuda.dll
I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\cuda\cuda_diagnostics.cc:165] hostname: �٩��

UPDATE3:

我从NVIDIA注册并下载了cudnn packge

 https://developer.nvidia.com/cudnn

移动了文件位置

C:\Desktop\cudnn-8.0-windows10-x64-v5.1.zip\cuda\bin\cudnn64_5.dll to C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0\bin\cudnn64_5.dll

仍然出现此错误:

 I c:\tf_jenkins\home\workspace\release-win\device\gpu\os\windows\tensorflow\stream_executor\dso_loader.cc:119] Couldn't open CUDA library nvcuda.dll

更新4:

将nvcuda.dll下载到C:\ Program Files \ NVIDIA GPU Computing Toolkit \ CUDA \ v8.0 \ bin

这解决了我的问题。

4 个答案:

答案 0 :(得分:3)

从Python解释器的路径(C:\Python\Python35-32)看来,您使用的是32位版本的Python 3.5。官方TensorFlow软件包仅适用于64位体系结构(x64 / amd64),因此您有两种选择:

  1. 安装Python 3.5的64-bit version(来自Python.org或Anaconda),

  2. 自行编译PIP包以获取32位Python 3.5。您可以使用实验性CMake构建来执行此操作(有关详细信息,请参阅here),但这不是受支持或测试的配置。

  3. (请注意,我不确定您是如何在32位版本的Python上安装软件包的,因为当我尝试这样做时,我收到一条错误消息:“此平台上不支持此轮。”)< / p>

答案 1 :(得分:0)

问题不在于平台(amd64),而在于GPU驱动程序。您需要安装在CPU上运行的软件包或使用已安装的GPU,但也要安装CUDA驱动程序。

答案 2 :(得分:0)

你可以在&#34; cuda \ bin&#34; [这是cudnn-8.0-windows7-x64-v5.1_4 zip提取文件夹]中找到cudnn64_5.dll文件。然后复制上面将文件存入&#34; C:\ Program Files \ NVIDIA GPU Computing Toolkit \ CUDA \ v8.0 \ bin&#34; 。 这适用于Python 3.5 bit 64版本和Windows 7 bit 64环境

答案 3 :(得分:0)

如果您要安装GPU版本,请确保您的系统具有以下功能:

  • CUDA®Toolkit9.0。有关详细信息,请参阅NVIDIA的文档确保 您将相关的Cuda路径名附加到%PATH%环境 变量如NVIDIA文档中所述。
  • 与CUDA Toolkit 9.0相关联的NVIDIA驱动程序。
  • cuDNN v7.0。有关详细信息,请参阅NVIDIA的文档。请注意cuDNN 通常安装在与其他CUDA不同的位置 DLL文件。确保添加安装cuDNN的目录 DLL到%PATH%环境变量。
  • 具有CUDA Compute Capability 3.0或更高版本的GPU卡,用于构建 我们的二进制文件的来源和3.5或更高。请参阅NVIDIA文档 获取支持的GPU卡列表。