2017-07-24 5 views
0

Ich möchte den Client in Py3 aufgrund einiger Abhängigkeiten, die ich habe, erstellen können. Es baut gut, , aber wenn ich die gebaute Binärdatei ausführen, wird ein Fehler 'undefined symbol: PyClass_Type' ausgelöst. Dies ist ein Typ, der nur in Py2 C verfügbar ist, wie here notiert. Die Datei _pywrap_tensorflow_internal.so wird automatisch generiert. Wie kann ich den Client in Py3 erstellen und ausführen?Wie Client in Python 3 in Tensorflow Serving erstellen und ausführen

[email protected]:~/serving$ bazel build //tensorflow_serving/example:mnist_client --force_python=PY3 
WARNING: ignoring http_proxy in environment. 
WARNING: /home/ub64/.cache/bazel/_bazel_ub64/5546b242b4fa6d955b95bc3b90b5397e/external/org_tensorflow/tensorflow/contrib/learn/BUILD:15:1: in py_library rule @org_tensorflow//tensorflow/contrib/learn:learn: target '@org_tensorflow//tensorflow/contrib/learn:learn' depends on deprecated target '@org_tensorflow//tensorflow/contrib/session_bundle:exporter': Use SavedModel Builder instead. 
WARNING: /home/ub64/.cache/bazel/_bazel_ub64/5546b242b4fa6d955b95bc3b90b5397e/external/org_tensorflow/tensorflow/contrib/learn/BUILD:15:1: in py_library rule @org_tensorflow//tensorflow/contrib/learn:learn: target '@org_tensorflow//tensorflow/contrib/learn:learn' depends on deprecated target '@org_tensorflow//tensorflow/contrib/session_bundle:gc': Use SavedModel instead. 
INFO: Found 1 target... 
Target //tensorflow_serving/example:mnist_client up-to-date: 
    bazel-bin/tensorflow_serving/example/mnist_client 
INFO: Elapsed time: 0.721s, Critical Path: 0.00s 
[email protected]:~/serving$ bazel-bin/tensorflow_serving/example/mnist_client 
Traceback (most recent call last): 
    File "/home/ub64/serving/bazel-bin/tensorflow_serving/example/mnist_client.runfiles/org_tensorflow/tensorflow/python/pywrap_tensorflow.py", line 41, in <module> 
    from tensorflow.python.pywrap_tensorflow_internal import * 
    File "/home/ub64/serving/bazel-bin/tensorflow_serving/example/mnist_client.runfiles/org_tensorflow/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module> 
    _pywrap_tensorflow_internal = swig_import_helper() 
    File "/home/ub64/serving/bazel-bin/tensorflow_serving/example/mnist_client.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/ub64/serving/bazel-bin/tensorflow_serving/example/mnist_client.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/ub64/serving/bazel-bin/tensorflow_serving/example/mnist_client.runfiles/tf_serving/tensorflow_serving/example/mnist_client.py", line 37, in <module> 
    import tensorflow as tf 
    File "/home/ub64/serving/bazel-bin/tensorflow_serving/example/mnist_client.runfiles/org_tensorflow/tensorflow/__init__.py", line 24, in <module> 
    from tensorflow.python import * 
    File "/home/ub64/serving/bazel-bin/tensorflow_serving/example/mnist_client.runfiles/org_tensorflow/tensorflow/python/__init__.py", line 49, in <module> 
    from tensorflow.python import pywrap_tensorflow 
    File "/home/ub64/serving/bazel-bin/tensorflow_serving/example/mnist_client.runfiles/org_tensorflow/tensorflow/python/pywrap_tensorflow.py", line 52, in <module> 
    raise ImportError(msg) 
ImportError: Traceback (most recent call last): 
    File "/home/ub64/serving/bazel-bin/tensorflow_serving/example/mnist_client.runfiles/org_tensorflow/tensorflow/python/pywrap_tensorflow.py", line 41, in <module> 
    from tensorflow.python.pywrap_tensorflow_internal import * 
    File "/home/ub64/serving/bazel-bin/tensorflow_serving/example/mnist_client.runfiles/org_tensorflow/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module> 
    _pywrap_tensorflow_internal = swig_import_helper() 
    File "/home/ub64/serving/bazel-bin/tensorflow_serving/example/mnist_client.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/ub64/serving/bazel-bin/tensorflow_serving/example/mnist_client.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. 

Einstellungen

[email protected]:~/serving$ uname -a 
Linux ub64-VirtualBox 4.8.0-58-generiC#63~16.04.1-Ubuntu SMP Mon Jun 26 18:08:51 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux 
[email protected]:~/serving$ python3 
Python 3.5.2 (default, Nov 17 2016, 17:05:23) 
[GCC 5.4.0 20160609] on linux 
[email protected]:~/serving/tensorflow$ bazel version 
WARNING: ignoring http_proxy in environment. 
Build label: 0.5.2 
+0

pip habe ich die Ubuntu 16.04 tensorflow Docker Bild, kloniert, um das Servieren Repo in github.com/tensorflow/serving/blob beschrieben als/master/tensorflow_serving/..., baute es und führt die zwei Befehle aus, die Sie haben. Es hat gut funktioniert. serving $ bazel-bin/tensorflow_reservierung/example/mnist_client -> bitte spezifizieren server host: port serving $ python3 bazel-bin/tensorflow_reservierung/beispiel/mnist_client -> bitte geben sie server host: port an – iga

Antwort

0

habe ich den gleichen Fehler python3 mit und von der Quelle installiert.

versuchen, zu installieren, dient apt-get und dem Model von https://www.tensorflow.org/serving/setup

pip install --upgrade tensorflow-serving-api-python3 
sudo apt-get update && sudo apt-get install tensorflow-model-server 
Verwandte Themen