2
votes

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?

2
its in mac..... - user3600801
Which directory are you running the command from? Also it looks like you have conflicting paths /Users/Rocky vs, /Users/Stanly. You might considering cleaning the project. - l'L'l
still the same error - user3600801
You need to run ./configure... - l'L'l
do you find any of the answers useful? If you do, please accept one or tell us what else would you need if you don't. :) - bendaf

2 Answers

2
votes

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.

0
votes

(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?