serving icon indicating copy to clipboard operation
serving copied to clipboard

When import export.py , ImportError: cannot import name manifest_pb2

Open kahitomi opened this issue 10 years ago • 5 comments

I include tensorflow_serving folder in sys path, and try to import exporter.py, but

File "/exstore/tensorflow_serving/tensorflow_serving/session_bundle/exporter.py", line 33, in <module> 
from tensorflow_serving.session_bundle import manifest_pb2
ImportError: cannot import name manifest_pb2

kahitomi avatar May 19 '16 18:05 kahitomi

Oh, I use

bazel build -c opt tensorflow_serving/...

Because "bazel build tensorflow_serving/..." has an error, is this the reason why manifest_pb2 disapear?

kahitomi avatar May 19 '16 18:05 kahitomi

Hi Wei,

When you say that "bazel build tensorflow_serving/..." has an error, do you mean there was an error above the ImportError you mentioned? Can you send the entire sequence of bazel errors. It's important to know what the first error was.

-Chris

On Thu, May 19, 2016 at 11:44 AM Wei Jia [email protected] wrote:

Oh, I use

bazel build -c opt tensorflow_serving/...

Because "bazel build tensorflow_serving/..." has an error, is this the reason why manifest_pb2 disapear?

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/tensorflow/serving/issues/84#issuecomment-220415243

chrisolston avatar May 19 '16 18:05 chrisolston

@chrisolston Sorry, it seems that I got two problems.

The first

bazel build tensorflow_serving/...

Then

[4,119 / 4,688] Still waiting for 200 jobs to complete:
[4,124 / 4,688] Still waiting for 200 jobs to complete:
ERROR: /exstore/tensorflow_serving/tensorflow_serving/core/BUILD:499:1: Linking of rule '//tensorflow_serving/core:aspired_versions_manager_test' failed: gcc failed: error executing command /usr/bin/gcc -o bazel-out/local-fastbuild/bin/tensorflow_serving/core/aspired_versions_manager_test '-Wl,-rpath,$ORIGIN/../../_solib_k8/' -Lbazel-out/local-fastbuild/bin/_solib_k8 -pthread ... (remaining 10 argument(s) skipped): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1.
collect2: error: ld returned 1 exit status
INFO: Elapsed time: 3534.851s, Critical Path: 2097.11s

The second

bazel build -c opt tensorflow_serving/...

Then, build successd. But when import export.py, manifest_pb2 disapeard

File "/exstore/tensorflow_serving/tensorflow_serving/session_bundle/exporter.py", line 33, in <module> 
from tensorflow_serving.session_bundle import manifest_pb2
ImportError: cannot import name manifest_pb2

kahitomi avatar May 19 '16 20:05 kahitomi

I follow bazel-bin/tensorflow_serving/example/mnist_export and find a appropriate way to import. So the main problem here has solved. However, I still do not know the reason for the first problem above.

kahitomi avatar May 23 '16 12:05 kahitomi

@kahitomi The magic in mnist_export is this script updates the PYTHONPATH to includes the manifest_pb2 module which is built by bazel and saved in the temp build path. However, this module is not installed so the exporter.py can't find the module if you run it directly.

llhe avatar Jul 26 '16 10:07 llhe