Serving: TensorFlow Serving example clients error, Python 2.7

Created on 11 Jul 2016  路  3Comments  路  Source: tensorflow/serving

The inference code is running properly
$ bazel-bin/tensorflow_serving/example/mnist_inference --port=9000 /tmp/mnist_model/00000001

But when I try the client code
$ bazel-bin/tensorflow_serving/example/mnist_client --num_tests=10 --server=localhost:9000

Getting this error:

Traceback (most recent call last):
  File "/home/dreamrulez_07/serving/bazel-bin/tensorflow_serving/example/mnist_client.runfiles/tf_serving/tensorflow_serving/example/mnist_c
lient.py", line 34, in <module>
    from grpc.beta import implementations
ImportError: No module named grpc.beta

Then if I do:
$ pip install grpcio

It works but then I get this error instead:

D0711 15:56:08.738800023   30789 ev_posix.c:101]             Using polling engine: poll
('Extracting', '/tmp/train-images-idx3-ubyte.gz')
('Extracting', '/tmp/train-labels-idx1-ubyte.gz')
('Extracting', '/tmp/t10k-images-idx3-ubyte.gz')
('Extracting', '/tmp/t10k-labels-idx1-ubyte.gz')
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "/home/dreamrulez_07/.local/lib/python2.7/site-packages/grpc/_channel.py", line 658, in _call_spin
    completed_call = event.tag(event)
  File "/home/dreamrulez_07/.local/lib/python2.7/site-packages/grpc/_channel.py", line 174, in handle_event
    callback()
  File "/home/dreamrulez_07/.local/lib/python2.7/site-packages/grpc/_channel.py", line 294, in <lambda>
    self._state.callbacks.append(lambda: fn(self))
  File "/home/dreamrulez_07/.local/lib/python2.7/site-packages/grpc/beta/_client_adaptations.py", line 135, in <lam
bda>
    self._future.add_done_callback(lambda ignored_callback: fn(self))
  File "/home/dreamrulez_07/serving/bazel-bin/tensorflow_serving/example/mnist_client.runfiles/tf_serving/tensorflo
w_serving/example/mnist_client.py", line 98, in <lambda>
    lambda result_future, l=label[0]: done(result_future, l))  # pylint: disable=cell-var-from-loop
  File "/home/dreamrulez_07/serving/bazel-bin/tensorflow_serving/example/mnist_client.runfiles/tf_serving/tensorflo
w_serving/example/mnist_client.py", line 73, in done
    exception = result_future.exception()
  File "/home/dreamrulez_07/.local/lib/python2.7/site-packages/grpc/beta/_client_adaptations.py", line 120, in exce
ption
    return _abortion_error(rpc_error_call)
  File "/home/dreamrulez_07/.local/lib/python2.7/site-packages/grpc/beta/_client_adaptations.py", line 74, in _abor
tion_error
    code = rpc_error_call.code()
AttributeError: 'NoneType' object has no attribute 'code'

How can this be fixed?

duplicate

Most helpful comment

I had the same issue with the latest master of TF serving.
It seems like the Dockerfile installs grpcio not from pypi.python.org and thus the newer grpcio release is not picked up.

All 3 comments

The first error is simply because gRPC wasn't installed, and it you got around that. The second error is a known issue in gRPC which should now be fixed at head, but apparently not in the latest installed version. I'll follow up with the gRPC team to see how we should proceed.

There is already an issue tracking this in Tensorflow serving that has more historic context, so I'm closing this issue as a duplicate.

I had the same issue with the latest master of TF serving.
It seems like the Dockerfile installs grpcio not from pypi.python.org and thus the newer grpcio release is not picked up.

I had the same issue. but I found that there is a file
bazel-bin/tensorflow_serving/example/mnist_client.runfiles/tf_serving/tensorflow_serving/example/mnist_client
and there was a line
PYTHON_BINARY = '/usr/bin/python'
and I changed it into my real python path and the mistake solved.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

daikankan picture daikankan  路  4Comments

marcoadurno picture marcoadurno  路  3Comments

dylanrandle picture dylanrandle  路  3Comments

brianschardt picture brianschardt  路  3Comments

sskgit picture sskgit  路  4Comments