从源代码构建张量流错误:读取扩展文件“ closure / defs.bzl”时遇到错误:没有此类软件包

时间:2019-02-03 05:21:21

标签: tensorflow build bazel

我需要从源代码构建张量流。

git clone之后,运行以下检查命令:

bazel test -c opt -- //tensorflow/... -//tensorflow/compiler/... -//tensorflow/contrib/lite/...

然后出现以下错误:

bazel test -c opt -- //tensorflow/... -//tensorflow/compiler/... -//tensorflow/contrib/lite/...
WARNING: The following rc files are no longer being read, please transfer their contents or import their path into one of the standard rc files:
/home/rich/research/installations/tensorflow/tensorflow/tools/bazel.rc

INFO: Invocation ID: 1a1c9f70-531e-49a0-b8e7-9f4d7ab4b24b
ERROR: error loading package '': Encountered error while reading extension file 'closure/defs.bzl': no such package '@io_bazel_rules_closure//closure': The native http_archive rule is deprecated. load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") for a drop-in replacement.
Use --incompatible_remove_native_http_archive=false to temporarily continue using the native rule.

ERROR: error loading package '': Encountered error while reading extension file 'closure/defs.bzl': no such package '@io_bazel_rules_closure//closure': The native http_archive rule is deprecated. load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") for a drop-in replacement.
Use --incompatible_remove_native_http_archive=false to temporarily continue using the native rule.

INFO: Elapsed time: 0.046s

INFO: 0 processes.

FAILED: Build did NOT complete successfully (0 packages loaded)
FAILED: Build did NOT complete successfully (0 packages loaded)

1 个答案:

答案 0 :(得分:0)

听起来像您使用的bazel版本太新了。

根据https://blog.bazel.build/发布的最新bazel版本为0.22,但是https://www.tensorflow.org/install/source的“经过测试的构建配置”部分中提到的最新bazel版本为0.15.0(用于tensorflow 1.12)