在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 Computing Toolkit/CUDA/v9.2/CUDA/include/cudnn.h在那里。
我试过从VS2015 x64本机工具命令提示符、cmd和powershell运行它,但得到了相同的错误。
我还尝试将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.