Serving: Running example/mnist_saved_model /tmp/mnist_model error _pywrap_tensorflow_internal.so: undefined symbol: PyClass_Type

Created on 28 Feb 2018  路  10Comments  路  Source: tensorflow/serving

Hi Dear
I met an error when running the example of the mnist_model of the tensorflow_serving:

root@weizhen-Lenovo-IdeaPad-Y470:/home/weizhen/serving# bazel-bin/tensorflow_serving/example/mnist_saved_model /tmp/mnist_model

with the version of
ubuntu :16
tensorflow :1.5.0
python : 3.5.2
If anything you can help . I will be much apperciated

And the details is as blow:

`

root@weizhen-Lenovo-IdeaPad-Y470:/home/weizhen/serving# bazel-bin/tensorflow_serving/example/mnist_saved_model /tmp/mnist_model
Traceback (most recent call last):
File "/home/weizhen/serving/bazel-bin/tensorflow_serving/example/mnist_saved_model.runfiles/org_tensorflow/tensorflow/python/pywrap_tensorflow.py", line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "/home/weizhen/serving/bazel-bin/tensorflow_serving/example/mnist_saved_model.runfiles/org_tensorflow/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File "/home/weizhen/serving/bazel-bin/tensorflow_serving/example/mnist_saved_model.runfiles/org_tensorflow/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "/usr/lib/python3.5/imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "/usr/lib/python3.5/imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: /home/weizhen/serving/bazel-bin/tensorflow_serving/example/mnist_saved_model.runfiles/org_tensorflow/tensorflow/python/_pywrap_tensorflow_internal.so: undefined symbol: PyClass_Type

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/weizhen/serving/bazel-bin/tensorflow_serving/example/mnist_saved_model.runfiles/tf_serving/tensorflow_serving/example/mnist_saved_model.py", line 35, in
import tensorflow as tf
File "/home/weizhen/serving/bazel-bin/tensorflow_serving/example/mnist_saved_model.runfiles/org_tensorflow/tensorflow/__init__.py", line 24, in
from tensorflow.python import *
File "/home/weizhen/serving/bazel-bin/tensorflow_serving/example/mnist_saved_model.runfiles/org_tensorflow/tensorflow/python/__init__.py", line 49, in
from tensorflow.python import pywrap_tensorflow
File "/home/weizhen/serving/bazel-bin/tensorflow_serving/example/mnist_saved_model.runfiles/org_tensorflow/tensorflow/python/pywrap_tensorflow.py", line 74, in
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/home/weizhen/serving/bazel-bin/tensorflow_serving/example/mnist_saved_model.runfiles/org_tensorflow/tensorflow/python/pywrap_tensorflow.py", line 58, in
from tensorflow.python.pywrap_tensorflow_internal import *
File "/home/weizhen/serving/bazel-bin/tensorflow_serving/example/mnist_saved_model.runfiles/org_tensorflow/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in
_pywrap_tensorflow_internal = swig_import_helper()
File "/home/weizhen/serving/bazel-bin/tensorflow_serving/example/mnist_saved_model.runfiles/org_tensorflow/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "/usr/lib/python3.5/imp.py", line 242, in load_module
return load_dynamic(name, filename, file)
File "/usr/lib/python3.5/imp.py", line 342, in load_dynamic
return _load(spec)
ImportError: /home/weizhen/serving/bazel-bin/tensorflow_serving/example/mnist_saved_model.runfiles/org_tensorflow/tensorflow/python/_pywrap_tensorflow_internal.so: undefined symbol: PyClass_Type

Failed to load the native TensorFlow runtime.

See https://www.tensorflow.org/install/install_sources#common_installation_problems

for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
root@weizhen-Lenovo-IdeaPad-Y470:/home/weizhen/serving#
`
default
default

Most helpful comment

@weizhenzhao how did you fix it?

All 10 comments

I found the problem that the tensorflow_serving I downloaded was python2.7 version
so in python 2.7 version .I didn't install tensorflow
But I think I used git clone --recurse-submodules https://github.com/tensorflow/serving to download
the tensorflow serving
So is the default version of tensorflow_serving that git donwloaded is python 2.7?

I met the same problem under the same environment.
However, this error jumped out after "bazel run tensorflow/examples/speech_commands:generate_streaming_test_wav" this command.

@weizhenzhao how did you fix it?

This problem is because that I compile the framework in python2.7 version and in python 2.7 there's no tensorflow installed . So change the python version to python 3.5 then the problem maybe can be solved

Or you can reference to the blob written by me : http://www.cnblogs.com/weizhen/p/8491236.html

@weizhenzhao thanks for your sharing. May I ask that how to make ubuntu compile with python 3.5? I have no idea about this.

@weizhenzhao @NearLinHere I built tensorflow r.16 and install it. The I built the latest serving from sources. I am using Python 3.5 virtual environment on ubuntu 16.04.

When I run bazel-bin/tensorflow_serving/example/mnist_saved_model /tmp/mnist_model. I had the same issue. It seems the source code of serving does not work with Python 3 after googling.

I have met the same problem. My python version is 3.5.2, and tensorflow serving version is 1.7.0, bazel version is 0.13.0. Then how could it be solved please?

probably due to package version. the good news is that the docker version is working, with r.18 https://www.tensorflow.org/serving/docker

I found the problem that the tensorflow_serving I downloaded was python2.7 version
so in python 2.7 version .I didn't install tensorflow
But I think I used git clone --recurse-submodules https://github.com/tensorflow/serving to download
the tensorflow serving
So is the default version of tensorflow_serving that git donwloaded is python 2.7?

Thanks for your sharing.I have run into the same error when runing "bazel test -c opt -- //tensorflow/... -//tensorflow/compiler/... -//tensorflow/contrib/lite/..." according to the official instructions to build tensorflow from source. So if the default version of tensorflow that git donwloaded is python 2.7, how can i download a repository with python version 3.x ?

Was this page helpful?
0 / 5 - 0 ratings