Skip to content

Bazel not picking up the right protobuf python library. #1209

Closed

Description

@vinuraja

Trying to build TensorFlow Serving (specific rule //tensorflow_serving/session_bundle/example:half_plus_two) fails with this error.

Protobufs are imported as the submodule of TensorFlow, which is itself a submodule of TensorFlow Serving.

It seems like instead of getting this protobuf python library its picking up my local python protobuf library resulting in this error.

ERROR: /tmp/staging/serving-staging/tensorflow_serving/session_bundle/example/BUILD:34:1: Executing genrule //tensorflow_serving/session_bundle/example:half_plus_two failed: bash failed: error executing command /bin/bash -c ... (remaining 1 argument(s) skipped): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1.
Traceback (most recent call last):
  File "/usr/local/google/home/vinuraja/.cache/bazel/_bazel_vinuraja/4179d7df99792da64adb58f91ec06044/serving-staging/bazel-out/host/bin/tensorflow_serving/session_bundle/example/export_half_plus_two.runfiles/tensorflow_serving/session_bundle/example/export_half_plus_two.py", line 33, in <module>
    import tensorflow as tf
  File "/usr/local/google/home/vinuraja/.cache/bazel/_bazel_vinuraja/4179d7df99792da64adb58f91ec06044/serving-staging/bazel-out/host/bin/tensorflow_serving/session_bundle/example/export_half_plus_two.runfiles/external/tf/tensorflow/__init__.py", line 23, in <module>
    from tensorflow.python import *
  File "/usr/local/google/home/vinuraja/.cache/bazel/_bazel_vinuraja/4179d7df99792da64adb58f91ec06044/serving-staging/bazel-out/host/bin/tensorflow_serving/session_bundle/example/export_half_plus_two.runfiles/external/tf/tensorflow/python/__init__.py", line 49, in <module>
    from tensorflow.core.framework.graph_pb2 import *
  File "/usr/local/google/home/vinuraja/.cache/bazel/_bazel_vinuraja/4179d7df99792da64adb58f91ec06044/serving-staging/bazel-out/host/bin/tensorflow_serving/session_bundle/example/export_half_plus_two.runfiles/external/tf/tensorflow/core/framework/graph_pb2.py", line 9, in <module>
    from google.protobuf import symbol_database as _symbol_database
  File "/usr/local/google/home/vinuraja/.cache/bazel/_bazel_vinuraja/4179d7df99792da64adb58f91ec06044/serving-staging/bazel-out/host/bin/tensorflow_serving/session_bundle/example/export_half_plus_two.runfiles/external/tf/google/protobuf/symbol_database.py", line 180, in <module>
    _DEFAULT = SymbolDatabase(pool=descriptor_pool.Default())
AttributeError: 'module' object has no attribute 'Default'
Target //tensorflow_serving/session_bundle/example:half_plus_two failed to build

Output of 'bazel info'

bazel-bin: /usr/local/google/home/vinuraja/.cache/bazel/_bazel_vinuraja/4179d7df99792da64adb58f91ec06044/serving-staging/bazel-out/local_linux-fastbuild/bin
bazel-genfiles: /usr/local/google/home/vinuraja/.cache/bazel/_bazel_vinuraja/4179d7df99792da64adb58f91ec06044/serving-staging/bazel-out/local_linux-fastbuild/genfiles
bazel-testlogs: /usr/local/google/home/vinuraja/.cache/bazel/_bazel_vinuraja/4179d7df99792da64adb58f91ec06044/serving-staging/bazel-out/local_linux-fastbuild/testlogs
command_log: /usr/local/google/home/vinuraja/.cache/bazel/_bazel_vinuraja/4179d7df99792da64adb58f91ec06044/command.log
committed-heap-size: 508MB
execution_root: /usr/local/google/home/vinuraja/.cache/bazel/_bazel_vinuraja/4179d7df99792da64adb58f91ec06044/serving-staging
gc-count: 78
gc-time: 1065ms
install_base: /usr/local/google/home/vinuraja/.cache/bazel/_bazel_vinuraja/install/46732835f8fdfb418a51e9e1954eb778
max-heap-size: 8363MB
message_log: /usr/local/google/home/vinuraja/.cache/bazel/_bazel_vinuraja/4179d7df99792da64adb58f91ec06044/message.log
output_base: /usr/local/google/home/vinuraja/.cache/bazel/_bazel_vinuraja/4179d7df99792da64adb58f91ec06044
output_path: /usr/local/google/home/vinuraja/.cache/bazel/_bazel_vinuraja/4179d7df99792da64adb58f91ec06044/serving-staging/bazel-out
package_path: %workspace%
release: release 0.2.1
server_pid: 1379
used-heap-size: 85MB
workspace: /tmp/staging/serving-staging

Activity

  1. added
    P2
    on Apr 29, 2016
  2. meteorcloudy commented on Apr 29, 2016

    @meteorcloudy
    Member

    @damienmg Can you look into this?

  3. damienmg commented on Apr 29, 2016

    @damienmg
    Contributor
    $ bazel help build | grep python
    ..............
      --force_python (py2, py3, py2and3, py2only or py3only; default: see description)
      --host_force_python (py2, py3, py2and3, py2only or py3only; default: see description)
      --python2_path (a string; default: "python")
      --python3_path (a string; default: "python3")
    

    Maybe try to setting the path to python binary. It should definitely have protobuf in the python path. @davidzchen might have more insights.

  4. vinuraja commented on Apr 30, 2016

    @vinuraja
    Author

    @damienmg

    Well, things are working for me after I installed the latest python protobuf library. But Bazel shouldn't be using my local protobuf library, but the ones in the submodule.

  5. damienmg commented on May 2, 2016

    @damienmg
    Contributor

    Totally agree, that's definitely should not happen.

  6. davidzchen commented on May 12, 2016

    @davidzchen
    Member

    This is blocking tensorflow/tensorflow#1289. I'll go ahead and prioritize this and investigate.

  7. self-assigned this
    on May 12, 2016
  8. davidzchen commented on May 26, 2016

    @davidzchen
    Member

    This turned out to be a problem in the protobuf Bazel build setup. protocolbuffers/protobuf#1586 has been merged to fix this problem. Once tensorflow/tensorflow#1289 is merged to bump TensorFlow's dependency to the protobuf version that contains the fix, this problem will be fixed on the TensorFlow side as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2type: bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions