Whole day "bazel build" command fails. From logs I see that it compares check sum '@protobuf//' and they do not match. I've tried it on several machines - had same error.
git clone https://github.com/tensorflow/tensorflow.git
cd tensorflow
./configure
bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package
Operating System: Ubuntu 16.04
Bazel version (output of bazel info release): release 0.5.2 (also tried 0.5.3, 0.5.4 - had same result)
`
oleksandrmalinin@oleksandrmalinin:~/serving/tensorflow$ bazel build -c opt tensorflow/python/tools:freeze_graph
ERROR: /home/oleksandrmalinin/serving/tensorflow/tensorflow/python/tools/BUILD:32:1: error loading package 'tensorflow/core': Encountered error while reading extension file 'protobuf.bzl': no such package '@protobuf//': java.io.IOException: Error downloading [https://github.com/google/protobuf/archive/0b059a3d8a8f8aa40dde7bea55edca4ec5dfea66.tar.gz, http://mirror.bazel.build/github.com/google/protobuf/archive/0b059a3d8a8f8aa40dde7bea55edca4ec5dfea66.tar.gz] to /home/oleksandrmalinin/.cache/bazel/_bazel_oleksandrmalinin/2c37fc95110689297cb64483825480ed/external/protobuf/0b059a3d8a8f8aa40dde7bea55edca4ec5dfea66.tar.gz: Checksum was e5fdeee6b28cf6c38d61243adff06628baa434a22b5ebb7432d2a7fbabbdb13d but wanted 6d43b9d223ce09e5d4ce8b0060cb8a7513577a35a64c7e3dad10f0703bf3ad93 and referenced by '//tensorflow/python/tools:freeze_graph'.
ERROR: Analysis of target '//tensorflow/python/tools:freeze_graph' failed; build aborted.
INFO: Elapsed time: 14.464s
oleksandrmalinin@oleksandrmalinin:~/serving/tensorflow$ bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package
ERROR: /home/oleksandrmalinin/serving/tensorflow/tensorflow/tools/pip_package/BUILD:100:1: no such package '@protobuf//': java.io.IOException: Error downloading [https://github.com/google/protobuf/archive/0b059a3d8a8f8aa40dde7bea55edca4ec5dfea66.tar.gz, http://mirror.bazel.build/github.com/google/protobuf/archive/0b059a3d8a8f8aa40dde7bea55edca4ec5dfea66.tar.gz] to /home/oleksandrmalinin/.cache/bazel/_bazel_oleksandrmalinin/2c37fc95110689297cb64483825480ed/external/protobuf/0b059a3d8a8f8aa40dde7bea55edca4ec5dfea66.tar.gz: Checksum was e5fdeee6b28cf6c38d61243adff06628baa434a22b5ebb7432d2a7fbabbdb13d but wanted 6d43b9d223ce09e5d4ce8b0060cb8a7513577a35a64c7e3dad10f0703bf3ad93 and referenced by '//tensorflow/tools/pip_package:licenses'.
ERROR: Analysis of target '//tensorflow/tools/pip_package:build_pip_package' failed; build aborted.
INFO: Elapsed time: 1.090s
`
Hey -- take a look at https://github.com/tensorflow/tensorflow/issues/12979 ... it seems GitHub changed the way they compress archives and invalidated all the existing checksums. :(
Hi, @davidstanke ,
Thank you very much for response. I will monitor that issue :)
Got same issue, also solved by editing "tensorflow/workspace.bzl"
@BIG-CHENG how to edit it?
@100cm
I was able to get this to work by editing two files: third_party/repo.bzl and tensorflow/workspace.bzl
This assumes that you need to add a local repository due to network restrictions.
Add this to the bottom of your repo.bzl:
def _tf_local_repository(ctx):
ctx.symlink(ctx.attr.path, "")
tf_local_repository = repository_rule(
implementation=_tf_local_repository,
local=True,
attrs={"path": attr.string(mandatory=True)})
Add this to the top of your workspace.bzl
load("//third_party:repo.bzl", "tf_local_repository")
Finally, in the workspace.bzl, change both of the tf_http_archive to this (change PATH_TO_PROTOBUF to path of the archive on your machine):
tf_local_repository(
name = "protobuf_archive",
path = "PATH_TO_PROTOBUF",
)
# We need to import the protobuf library under the names com_google_protobuf
# and com_google_protobuf_cc to enable proto_library support in bazel.
# Unfortunately there is no way to alias http_archives at the moment.
tf_local_repository(
name = "com_google_protobuf",
path = "PATH_TO_PROTOBUF",
)
This also allows you to import any local repositories into the workspace.bzl now.
@alexanderremm I tried this and ran into an error about protobuf.bzl not having the @protobuf_archive// package - do you know why this might be happening?
ERROR: error loading package 'tensorflow': Encountered error while reading extension file 'protobuf.bzl': no such package '@protobuf_archive//': tf_local_repository rule //external:protobuf_archive must create a directory
INFO: Elapsed time: 0.145s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
currently loading: tensorflow
@nkjassal I am not sure why your protobuf.bzl is giving you an error. Double check the path to the archive. Mine ended up being something like this.
tf_local_repository(
name = "protobuf_archive",
path = "C:/bazel/repos/protobuf-3.6.0",
)
# We need to import the protobuf library under the names com_google_protobuf
# and com_google_protobuf_cc to enable proto_library support in bazel.
# Unfortunately there is no way to alias http_archives at the moment.
tf_local_repository(
name = "com_google_protobuf",
path = "C:/bazel/repos/protobuf-3.6.0",
)
The path should point to the directory of the BUILD file.
Let me know if you are still having issues.
Most helpful comment
Hey -- take a look at https://github.com/tensorflow/tensorflow/issues/12979 ... it seems GitHub changed the way they compress archives and invalidated all the existing checksums. :(