Search code examples
tensorflowbazel

Unable to build TensorFlow from source with bazel. 22nd January 2016


I wanted to install the latest TensorFlow from source. I pulled the repository, and then ran

bazel build -c opt //tensorflow/tools/pip_package:build_pip_package

I got this error:

ERROR: /home/samuelchin/tensorflow/tensorflow/models/embedding/BUILD:10:6: First argument of load() is a path, not a label. It should start with a single slash if it is an absolute path.
ERROR: /home/samuelchin/tensorflow/tensorflow/models/embedding/BUILD:10:6: file '/tensorflow:tensorflow.bzl.bzl' was not correctly loaded. Make sure the 'load' statement appears in the global scope in your file.
ERROR: /home/samuelchin/tensorflow/tensorflow/models/embedding/BUILD:104:1: name 'tf_gen_op_wrapper_py' is not defined.
ERROR: /home/samuelchin/tensorflow/tensorflow/tools/pip_package/BUILD:13:1: Target '//tensorflow/models/embedding:package' contains an error and its package is in error and referenced by '//tensorflow/tools/pip_package:build_pip_package'.
ERROR: Loading failed; build aborted.
INFO: Elapsed time: 0.071s.

Solution

  • There was a recent change to the TensorFlow BUILD files that causes the dependency on Bazel 0.1.4. This was announced on the [email protected] mailing list, but hasn't made it into the documentation on the website yet.

    As you have already discovered, upgrading Bazel to version 0.1.4 should fix this build error.