tensorflow: build optimize_for_inference fail

System information

  • Have I written custom code (as opposed to using a stock example script provided in TensorFlow): No

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Windows 7 x64

  • TensorFlow installed from (source or binary): binary (pip3 install…)

  • TensorFlow version (use command below): tensorflow 1.1.0 CPU only

  • Bazel version (if compiling from source): Build label: 0.5.0 Build target: bazel-out/msys_x64-fastbuild/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar Build time: Fri May 26 12:12:09 2017 (1495800729) Build timestamp: 1495800729 Build timestamp as int: 1495800729

    $ protoc --version libprotoc 3.2.0

  • CUDA/cuDNN version: CPU Only

Describe the problem

I want to build optimize_for_inference and optimize and would like to optimize my graph by the optimizer.But when I run bazel build tensorflow/python/tools:optimize_for_inference.It will get me a problem– Encountered error while reading extension file 'protobuf.bzl': no such package '@protobuf//'.The problem occurs when i try to build anything with tensorflow as dependancy,like:convert_graphdef_memmapped_format.
I’ve seen all the issues from github or stack overflow.And I tried all the fixes from issues or stackoverflow.But the problem still exists.

Source code / logs

Source code:

bazel build tensorflow/python/tools:optimize_for_inference && bazel-bin/tensorflow/python/tools/optimize_for_inference --input=frozen_inception_graph.pb --output=optimized_inception_graph.pb --frozen_graph=True --input_names=Mul --output_names=softmax

logs:

D:\tensorflow-r1.2>bazel build tensorflow/python/tools:optimize_for_inference
INFO: Loading complete.  Analyzing...
INFO: Downloading http://mirror.bazel.build/github.com/google/protobuf/archive/2b7430d96aeff2bb624c8d52182ff5e4b9f7f18a.tar.gz: 257,202 bytes
INFO: Downloading http://mirror.bazel.build/github.com/google/protobuf/archive/2b7430d96aeff2bb624c8d52182ff5e4b9f7f18a.tar.gz: 501,196 bytes
INFO: Downloading http://mirror.bazel.build/github.com/google/protobuf/archive/2b7430d96aeff2bb624c8d52182ff5e4b9f7f18a.tar.gz: 951,646 bytes
INFO: Downloading http://mirror.bazel.build/github.com/google/protobuf/archive/2b7430d96aeff2bb624c8d52182ff5e4b9f7f18a.tar.gz: 1,433,556 bytes
INFO: Downloading http://mirror.bazel.build/github.com/google/protobuf/archive/2b7430d96aeff2bb624c8d52182ff5e4b9f7f18a.tar.gz: 2,197,176 bytes
INFO: Downloading http://mirror.bazel.build/github.com/google/protobuf/archive/2b7430d96aeff2bb624c8d52182ff5e4b9f7f18a.tar.gz: 2,997,976 bytes
ERROR: D:/tensorflow-r1.2/tensorflow/python/tools/BUILD:133:1: error loading package 'tensorflow/core': Encountered error while reading extension file 'protobuf.bzl': no such packa
ge '@protobuf//': Traceback (most recent call last):
        File "D:/tensorflow-r1.2/tensorflow/workspace.bzl", line 117
                _apply_patch(repo_ctx, repo_ctx.attr.patch_file)
        File "D:/tensorflow-r1.2/tensorflow/workspace.bzl", line 108, in _apply_patch
                _execute_and_check_ret_code(repo_ctx, cmd)
        File "D:/tensorflow-r1.2/tensorflow/workspace.bzl", line 92, in _execute_and_check_ret_code
                fail("Non-zero return code({1}) when ..., <2 more arguments>))
Non-zero return code(3) when executing 'c:/tools/msys64/usr/bin/bash.exe -c patch -p1 -d C:/users/liba/appdata/local/temp/_bazel_liba/mffpt2ks/external/protobuf -i D:/tensorflow-r1.2/third_party/proto
buf/add_noinlines.patch':
Stdout: patching file src/google/protobuf/compiler/cpp/cpp_file.cc

Stderr: Assertion failed: hunk, file ../patch-2.5.9-src/patch.c, line 354

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
 and referenced by '//tensorflow/python/tools:optimize_for_inference'.
ERROR: Analysis of target '//tensorflow/python/tools:optimize_for_inference' failed; build aborted.
INFO: Elapsed time: 12.754s

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 36 (17 by maintainers)

Most upvoted comments

@meteorcloudy Thank you so much!!!It seems work.I will sort out a solution.Thanks again!!!

@meteorcloudy I get it!Thanks a lot!

To me it looks like downloading protobuf failed. Protobuf package is >4MB, and your messages seem to abruptly end at around 3MB. This may be caused by a flaky internet connection. I would recommend retrying build.