[英]bazel build tensorflow on windows 10 getting cudnn.h- system cannot find the file specified
I keep getting this error when trying to build the tensorflow-gpu using bazel and python in Windows 10: 在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.
This is the command I'm trying to run: 这是我要运行的命令:
bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package
I've confirmed the C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v9.2/cuda/include/cudnn.h is there. 我已经确认C:/ Program Files / NVIDIA GPU Computing Toolkit / CUDA / v9.2 / cuda / include / cudnn.h在那里。
I've tried running it from VS2015 x64 Native Tools Command Prompt, cmd, and powershell and get the same error. 我试过从VS2015 x64本机工具命令提示符,cmd和powershell运行它,并得到相同的错误。
I'm using bazel 0.16.1, CUDA 9.2, Anaconda3 (Python 3.6.5), and CUDNN 7.2.1. 我正在使用bazel 0.16.1,CUDA 9.2,Anaconda3(Python 3.6.5)和CUDNN 7.2.1。 I "installed" the CUDDNN files by unzipping its cuda folder into my C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v9.2 folder (ie the whole "cuda" folder).
通过将其cuda文件夹解压缩到我的C:\\ Program Files \\ NVIDIA GPU Computing Toolkit \\ CUDA \\ v9.2文件夹(即整个“ cuda”文件夹)中,我“安装”了CUDDNN文件。 I specified the C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v9.2\\cuda path in the cudnn path question when I ran the configure.py.
我在运行configure.py时在cudnn路径问题中指定了C:\\ Program Files \\ NVIDIA GPU Computing Toolkit \\ CUDA \\ v9.2 \\ cuda路径。 The configure.py completes without error.
configure.py完成,没有错误。
I also tried putting the CUDNN files directly in the C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v9.2 folder (instead of a cuda folder in there) and specified the default location and still get basically the same error: "C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v9.2/include/cudnn.h": The system cannot find the file specified. 我还尝试将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“:系统找不到指定的文件。
I've added these to my path (and rebooted): 我已经将它们添加到我的路径中(并重新启动):
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
These are the system variables I've set: 这些是我设置的系统变量:
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
This is the full error: 这是完整的错误:
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.
Any ideas what I could have done wrong, or what I might have missed, or what I could check next? 有什么想法我可能做错了什么,或者我可能错过了什么,或者接下来我可以检查什么?
The problem is a bug in cuda_configure.bzl
: it uses ctx.execute
instead of ctx.action.run_shell
. 问题是
cuda_configure.bzl
的错误:它使用ctx.execute
而不是ctx.action.run_shell
。 If you'd be so kind to file a bug to TensorFlow , that'd be great! 如果您愿意向TensorFlow提交错误 ,那就太好了!
To work around it: add c:\\tools\\msys64\\usr\\bin
to your PATH. 要解决此问题,请执行以下操作:将
c:\\tools\\msys64\\usr\\bin
到PATH。 That's where grep.exe
is so ctx.execute
can find grep
on the PATH. 那就是
grep.exe
所在的grep.exe
,因此ctx.execute
可以在PATH上找到grep
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.