简体   繁体   中英

Unable to run tensorflow using bazel

Im trying to run tensorflow using Bazel in my CPU supported mac.

I ran the following command,

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

and it is throwing the following error

ERROR: /Users/Rocky/Downloads/Experiment/TensorFlow/tensorflow-master/tensorflow/core/BUILD:1323:1: no such target '//tensorflow/tools/git:gen/spec.json': target 'gen/spec.json' not declared in package 'tensorflow/tools/git' defined by /Users/Rocky/Downloads/Experiment/TensorFlow/tensorflow-master/tensorflow/tools/git/BUILD and referenced by '//tensorflow/core:version_info_gen'. ERROR: /Users/Rocky/Downloads/Experiment/TensorFlow/tensorflow-master/tensorflow/core/BUILD:1323:1: no such target '//tensorflow/tools/git:gen/head': target 'gen/head' not declared in package 'tensorflow/tools/git' defined by /Users/Rocky/Downloads/Experiment/TensorFlow/tensorflow-master/tensorflow/tools/git/BUILD and referenced by '//tensorflow/core:version_info_gen'. ERROR: /Users/Rocky/Downloads/Experiment/TensorFlow/tensorflow-master/tensorflow/core/BUILD:1323:1: no such target '//tensorflow/tools/git:gen/branch_ref': target 'gen/branch_ref' not declared in package 'tensorflow/tools/git' defined by /Users/Rocky/Downloads/Experiment/TensorFlow/tensorflow-master/tensorflow/tools/git/BUILD and referenced by '//tensorflow/core:version_info_gen'. ERROR: Analysis of target '//tensorflow/tools/pip_package:build_pip_package' failed; build aborted.

How can I be able to sort this out?

I had the same issue, running the following command solved the problem for me:

./configure

I used all the default configurations. Check this issue for more info.

(Tried to comment but I have insufficient karma. Posting this as an answer then.)

The error message tells you that a build rule references a target that does not exist, or the rule doesn't have access to it.

What's the output of the following command? cd into the TensorFlow project's directory, where you have the WORKSPACE file, and run it from there):

bazel query --output=build 'somepath("//tensorflow/core:version_info_gen",  "//tensorflow/tools/git:gen/spec.json")'

Also:

  • What version of Bazel are you using?
  • Which commit of TensorFlow did you check out?
  • Did you modify anything in the source tree?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM