bazel在windows 10上构建tensorflow得到cudnn.h-系统找不到指定的文件

问题描述 投票:0回答:1

尝试在Windows 10中使用bazel和python构建tensorflow-gpu时,我不断收到此错误:

Cuda Configuration Error: Error reading C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v9.2/cuda/include/cudnn.h: ja
va.io.IOException: ERROR: src/main/native/windows/processes-jni.cc(239): CreateProcessW("grep" --color=never -A1 -E "#de
fine CUDNN_MAJOR" "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v9.2/cuda/include/cudnn.h"): The system cannot fin
d the file specified.

这是我正在尝试运行的命令:

bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package

我已经确认C:/ Program Files / NVIDIA GPU计算工具包/ CUDA / v9.2 / cuda / include / cudnn.h就在那里。

我试过从VS2015 x64 Native Tools命令提示符,cmd和powershell运行它并得到相同的错误。

我正在使用bazel 0.16.1,CUDA 9.2,Anaconda3(Python 3.6.5)和CUDNN 7.2.1。我通过将其cuda文件夹解压缩到我的C:\ Program Files \ NVIDIA GPU Computing Toolkit \ CUDA \ v9.2文件夹(即整个“cuda”文件夹)来“安装”CUDDNN文件。我在运行configure.py时在cudnn路径问题中指定了C:\ Program Files \ NVIDIA GPU Computing Toolkit \ CUDA \ v9.2 \ cuda路径。 configure.py完成且没有错误。

我还尝试将CUDNN文件直接放在C:\ Program Files \ NVIDIA GPU Computing Toolkit \ CUDA \ v9.2文件夹中(而不是那里的cuda文件夹)并指定默认位置并仍然得到基本相同的错误:“ C:/ Program Files / NVIDIA GPU Computing Toolkit / CUDA / v9.2 / include / cudnn.h“:系统找不到指定的文件。

我已将这些添加到我的路径中(并重新启动):

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\bin
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\libnvvp
C:\tools\msys64
C:\tools\bazel
C:\tools\bazel\bazel.exe
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\extras\CUPTI\libx64

这些是我设置的系统变量:

BAZEL_SH  C:\tools\msys64\usr\bin\bash.exe
BAZEL_VC  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC
BAZEL_VS  C:\Program Files (x86)\Microsoft Visual Studio 14.0

这是完整的错误:

ERROR: Skipping '//tensorflow/tools/pip_package:build_pip_package': error loading package 'tensorflow/tools/pip_package'
: Encountered error while reading extension file 'cuda/build_defs.bzl': no such package '@local_config_cuda//cuda': Trac
eback (most recent call last):
        File "C:/tensorflow/third_party/gpus/cuda_configure.bzl", line 1458
                _create_local_cuda_repository(repository_ctx)
        File "C:/tensorflow/third_party/gpus/cuda_configure.bzl", line 1185, in _create_local_cuda_repository
                _get_cuda_config(repository_ctx)
        File "C:/tensorflow/third_party/gpus/cuda_configure.bzl", line 909, in _get_cuda_config
                _cudnn_version(repository_ctx, cudnn_install_base..., ...)
        File "C:/tensorflow/third_party/gpus/cuda_configure.bzl", line 584, in _cudnn_version
                find_cuda_define(repository_ctx, cudnn_header_dir, "c...", ...)
        File "C:/tensorflow/third_party/gpus/cuda_configure.bzl", line 534, in find_cuda_define
                auto_configure_fail(("Error reading %s: %s" % (str(h...)))
        File "C:/tensorflow/third_party/gpus/cuda_configure.bzl", line 315, in auto_configure_fail
                fail(("\n%sCuda Configuration Error:%...)))

Cuda Configuration Error: Error reading C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v9.2/cuda/include/cudnn.h: ja
va.io.IOException: ERROR: src/main/native/windows/processes-jni.cc(239): CreateProcessW("grep" --color=never -A1 -E "#de
fine CUDNN_MAJOR" "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v9.2/cuda/include/cudnn.h"): The system cannot fin
d the file specified.

WARNING: Target pattern parsing failed.
ERROR: error loading package 'tensorflow/tools/pip_package': Encountered error while reading extension file 'cuda/build_
defs.bzl': no such package '@local_config_cuda//cuda': Traceback (most recent call last):
        File "C:/tensorflow/third_party/gpus/cuda_configure.bzl", line 1458
                _create_local_cuda_repository(repository_ctx)
        File "C:/tensorflow/third_party/gpus/cuda_configure.bzl", line 1185, in _create_local_cuda_repository
                _get_cuda_config(repository_ctx)
        File "C:/tensorflow/third_party/gpus/cuda_configure.bzl", line 909, in _get_cuda_config
                _cudnn_version(repository_ctx, cudnn_install_base..., ...)
        File "C:/tensorflow/third_party/gpus/cuda_configure.bzl", line 584, in _cudnn_version
                find_cuda_define(repository_ctx, cudnn_header_dir, "c...", ...)
        File "C:/tensorflow/third_party/gpus/cuda_configure.bzl", line 534, in find_cuda_define
                auto_configure_fail(("Error reading %s: %s" % (str(h...)))
        File "C:/tensorflow/third_party/gpus/cuda_configure.bzl", line 315, in auto_configure_fail
                fail(("\n%sCuda Configuration Error:%...)))

Cuda Configuration Error: Error reading C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v9.2/cuda/include/cudnn.h: ja
va.io.IOException: ERROR: src/main/native/windows/processes-jni.cc(239): CreateProcessW("grep" --color=never -A1 -E "#de
fine CUDNN_MAJOR" "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v9.2/cuda/include/cudnn.h"): The system cannot fin
d the file specified.

任何想法我可能做错了什么,或者我可能错过了什么,或者我接下来可以检查什么?

python windows tensorflow bazel cudnn
1个回答
2
投票

问题是cuda_configure.bzl中的一个错误:它使用ctx.execute而不是ctx.action.run_shell。如果你对file a bug to TensorFlow如此友善,那就太好了!

要解决此问题:将c:\tools\msys64\usr\bin添加到PATH中。这就是grep.exe所以ctx.execute可以在PATH上找到grep

© www.soinside.com 2019 - 2024. All rights reserved.