Thursday, March 10, 2016

First argument of load() is a path, not a label. It should start with a single slash if it is an absolute path.

When using Bazel for building TensorFlow, you might encounter the following error:

$ bazel build -c opt //tensorflow/tools/pip_package:build_pip_package
ERROR: /Users/izeye/IdeaProjects/tensorflow/tensorflow/tools/pip_package/BUILD:6: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: /Users/izeye/IdeaProjects/tensorflow/tensorflow/tools/pip_package/BUILD:6:6: file '/tensorflow:tensorflow.bzl.bzl' was not correctly loaded. Make sure the 'load' statement appears in the global scope in your file.
ERROR: /Users/izeye/IdeaProjects/tensorflow/tensorflow/tools/pip_package/BUILD:8:1: name 'transitive_hdrs' is not defined.
ERROR: no such package 'tensorflow/tools/pip_package': Package 'tensorflow/tools/pip_package' contains errors.
INFO: Elapsed time: 0.060s.
$

Check your Bazel version as follows:

$ bazel version
Build label: 0.1.2-homebrew
Build target: bazel-out/local_darwin-fastbuild/bin/src/main/java/com/google/devtools/build/lib/bazel-main_deploy.jar
Build time: Sat Dec 5 08:46:47 2015 (1449305207)
Build timestamp: 1449305207
Build timestamp as int: 1449305207
$

If the version is lower than 0.1.4 as the above, upgrade to at least 0.1.4.

You can find Bazel releases in: https://github.com/bazelbuild/bazel/releases

If you're using Mac, download an install script and run it with sudo.

Reference:
https://github.com/tensorflow/tensorflow/issues/843

No comments:

Post a Comment