Tensorflow Hub从源代码失败构建

时间:2019-04-04 10:51:06

标签: bazel tensorflow-hub

从源代码构建TF Hub时遇到问题。有人可以帮我吗?我一直遵循https://github.com/tensorflow/hub/blob/master/tensorflow_hub/pip_package/PIP.md中给出的步骤 我已经安装了bazel 0.24.1。

我遇到的错误:

ERROR: /home/tf_hub/hub/WORKSPACE:17:1: name 'git_repository' is not defined
ERROR: /home/tf_hub/hub/WORKSPACE:40:1: name 'http_archive' is not defined
ERROR: /home/tf_hub/hub/WORKSPACE:47:1: name 'new_http_archive' is not defined
ERROR: Error evaluating WORKSPACE file
ERROR: error loading package '': Encountered error while reading extension file 'tools/build_defs/repo/http.bzl': no such package '@bazel_tools//tools/build_defs/repo': error loading package 'external': Could not load //external package
ERROR: error loading package '': Encountered error while reading extension file 'tools/build_defs/repo/http.bzl': no such package '@bazel_tools//tools/build_defs/repo': error loading package 'external': Could not load //external package
INFO: Elapsed time: 2.552s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)

Bazel版本:0.24.1

Python版本:3

Tensorflow版本:2.0.0a

复制命令:

(env)~/tf_hub$ git clone https://github.com/tensorflow/hub
(env)~/tf_hub$ cd hub && bazel build tensorflow_hub/pip_package:build_pip_package

预期输出:无错误。建立成功

1 个答案:

答案 0 :(得分:0)

Bazel的最新版本不支持git_repository(tensorflow_hub仍在使用),因此可以卸载Bazel 0.24.1和安装Bazel 0.18.1。