Skip to content

no such package '@com_google_protobuf error while running bazel build #35414

@4dcity

Description

@4dcity

System information

  • OS Platform and Distribution: Windows10 x64
  • TensorFlow installed from: binary
  • TensorFlow version: 1.15.0
  • Python version: 3.7
  • Installed using: conda
  • Bazel version (if compiling from source): 1.1/2.0
  • CUDA/cuDNN version: 10.0

I was trying to inspect a model following the guide here
When running the command

bazel build tensorflow/tools/graph_transforms:summarize_graph

it failed with these logs

INFO: Writing tracer profile to 'C:/users/yy/_bazel_yy/zxtlmlwl/command.profile.gz'
INFO: Options provided by the client:
  Inherited 'common' options: --isatty=1 --terminal_columns=120
INFO: Options provided by the client:
  'build' options: --python_path=C:/Users/YY/Anaconda3/python.exe
INFO: Reading rc options for 'build' from e:\tensorflow\tensorflow\.bazelrc:
  'build' options: --apple_platform_type=macos --define framework_shared_object=true --define open_source_build=true --java_toolchain=//third_party/toolchains/java:tf_java_toolchain --host_java_toolchain=//third_party/toolchains/java:tf_java_toolchain --define=use_fast_cpp_protos=true --define=allow_oversize_protos=true --spawn_strategy=standalone -c opt --announce_rc --define=grpc_no_ares=true --noincompatible_remove_legacy_whole_archive --enable_platform_specific_config --config=v2
INFO: Found applicable config definition build:v2 in file e:\tensorflow\tensorflow\.bazelrc: --define=tf_api_version=2 --action_env=TF2_BEHAVIOR=1
INFO: Found applicable config definition build:windows in file e:\tensorflow\tensorflow\.bazelrc: --copt=/w --copt=/D_USE_MATH_DEFINES --cxxopt=/std:c++14 --host_cxxopt=/std:c++14 --config=monolithic --copt=-DWIN32_LEAN_AND_MEAN --host_copt=-DWIN32_LEAN_AND_MEAN --copt=-DNOGDI --host_copt=-DNOGDI --linkopt=/DEBUG --host_linkopt=/DEBUG --linkopt=/OPT:REF --host_linkopt=/OPT:REF --linkopt=/OPT:ICF --host_linkopt=/OPT:ICF --experimental_strict_action_env=true --incompatible_windows_native_test_wrapper --verbose_failures --distinct_host_configuration=false
INFO: Found applicable config definition build:monolithic in file e:\tensorflow\tensorflow\.bazelrc: --define framework_shared_object=false
INFO: Call stack for the definition of repository 'com_google_protobuf' which is a tf_http_archive (rule definition at E:/tensorflow/tensorflow/third_party/repo.bzl:121:19):
 - E:/tensorflow/tensorflow/tensorflow/workspace.bzl:457:5
 - E:/tensorflow/tensorflow/WORKSPACE:19:1
INFO: Repository 'com_google_protobuf' used the following cache hits instead of downloading the corresponding file.
 * Hash 'b9e92f9af8819bbbc514e2902aec860415b70209f31dfc8c4fa72515a5df9d59' for https://storage.googleapis.com/mirror.tensorflow.org/github.com/protocolbuffers/protobuf/archive/310ba5ee72661c081129eb878c1bbcec936b20f0.tar.gz
If the definition of 'com_google_protobuf' was updated, verify that the hashes were also updated.
ERROR: An error occurred during the fetch of repository 'com_google_protobuf':
   Traceback (most recent call last):
        File "E:/tensorflow/tensorflow/third_party/repo.bzl", line 101
                _apply_patch(ctx, <1 more arguments>)
        File "E:/tensorflow/tensorflow/third_party/repo.bzl", line 68, in _apply_patch
                _execute_and_check_ret_code(ctx, <1 more arguments>)
        File "E:/tensorflow/tensorflow/third_party/repo.bzl", line 52, in _execute_and_check_ret_code
                fail(<1 more arguments>)
Non-zero return code(2) when executing 'C:\Windows\system32\bash.exe -l -c "patch" "-p1" "-d" "C:/users/yy/_bazel_yy/zxtlmlwl/external/com_google_protobuf" "-i" "E:/tensorflow/tensorflow/third_party/protobuf/protobuf.patch"':
Stdout:
Stderr: patch: **** Can't change to directory C:/users/yy/_bazel_yy/zxtlmlwl/external/com_google_protobuf : No such file or directory
ERROR: Analysis of target '//tensorflow/tools/graph_transforms:summarize_graph' failed; build aborted: no such package '@com_google_protobuf//': Traceback (most recent call last):
        File "E:/tensorflow/tensorflow/third_party/repo.bzl", line 101
                _apply_patch(ctx, <1 more arguments>)
        File "E:/tensorflow/tensorflow/third_party/repo.bzl", line 68, in _apply_patch
                _execute_and_check_ret_code(ctx, <1 more arguments>)
        File "E:/tensorflow/tensorflow/third_party/repo.bzl", line 52, in _execute_and_check_ret_code
                fail(<1 more arguments>)
Non-zero return code(2) when executing 'C:\Windows\system32\bash.exe -l -c "patch" "-p1" "-d" "C:/users/yy/_bazel_yy/zxtlmlwl/external/com_google_protobuf" "-i" "E:/tensorflow/tensorflow/third_party/protobuf/protobuf.patch"':
Stdout:
Stderr: patch: **** Can't change to directory C:/users/yy/_bazel_yy/zxtlmlwl/external/com_google_protobuf : No such file or directory
INFO: Elapsed time: 3.975s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded, 0 targets configured)
    currently loading: tensorflow

I've tried diferent versions of bazel, 0.20, 1.1.0, and 2.0.0,and bazel clean, the error is still there.
What makes me confused is that the " Can't change to directory C:/users/yy/_bazel_yy/zxtlmlwl/external/com_google_protobuf : No such file or directory", which in fact I can find the dir at that path

I've checked other similar issue, but none can fix this error

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions