Problem with grpc Python on Ubuntu 16.04

2,587 views
Skip to first unread message

Zachary Deretsky

unread,
Jun 30, 2016, 6:23:28 PM6/30/16
to grpc.io
My code exhibits the same problem as the example helloworld:

zach@Roma:/DEV/STAGE/grpc/examples/python/helloworld$ python greeter_server.py 
Traceback (most recent call last):
  File "greeter_server.py", line 34, in <module>
    import helloworld_pb2
  File "/DEV/STAGE/grpc/examples/python/helloworld/helloworld_pb2.py", line 112, in <module>
    from grpc.beta import implementations as beta_implementations
  File "/usr/local/lib/python2.7/dist-packages/grpc/beta/implementations.py", line 39, in <module>
    from grpc import _auth
  File "/usr/local/lib/python2.7/dist-packages/grpc/_auth.py", line 43, in <module>
    class GoogleCallCredentials(grpc.AuthMetadataPlugin):
AttributeError: 'module' object has no attribute 'AuthMetadataPlugin'

I did ran pip install grpcio and pip install grpcio-tools

Thanks, Zach.

i...@meridianapps.com

unread,
Jun 30, 2016, 7:02:24 PM6/30/16
to grpc.io
Hi Zach,

I just ran into this trying to get up and running myself - I think the package versions on pypi have not been updated from this issue? https://github.com/grpc/grpc/issues/6935

Anyway, in the meantime I just installed grpc from master into my virtualenv (as per that issue) with GRPC_PYTHON_BUILD_WITH_CYTHON=1 venv/bin/pip install --upgrade .

Hope that helps!

Zachary Deretsky

unread,
Jun 30, 2016, 7:32:25 PM6/30/16
to grpc.io


On Thursday, June 30, 2016 at 3:23:28 PM UTC-7, Zachary Deretsky wrote:

Zachary Deretsky

unread,
Jun 30, 2016, 7:37:20 PM6/30/16
to grpc.io
Thank you.
Could you post more detail?
I compiled grpc from source. Do you mean that I need to recompile it with the environment var h GRPC_PYTHON_BUILD_WITH_CYTHON=1 ?
What does "pip install --upgrade" do?

Zach.

On Thursday, June 30, 2016 at 3:23:28 PM UTC-7, Zachary Deretsky wrote:

i...@meridianapps.com

unread,
Jun 30, 2016, 8:00:59 PM6/30/16
to grpc.io
Sure thing, though I'm super familiar with pip or grpc, I was just messing about and lucked into something that worked for me.

With a bare pip install grpcio on pip version 8.1.2 in a fresh virtualenv, I was running into the same problems as you were when I ran the greeter_server.py example - eg, the AuthMetadaPlugin ImportError. What fixed it for me was checking out the grpc repo and, at its root directory in the master branch, running 'GRPC_PYTHON_BUILD_WITH_CYTHON=1 pip install --upgrade .'

This gave me a version of grpcio in my virtualenv that was built from the master branch rather than the release currently available on pypi. I wouldn't recommend relying on the master branch being stable of course - I was just trying to get through the tutorial. Ideally whatever the issue is with the pypi release will be fixed, but this worked for me in the meantime.

Ken Payson

unread,
Jun 30, 2016, 8:01:46 PM6/30/16
to grpc.io
I can confirm the issue that you are seeing.  There was a bug in the 0.15.0 release of grpico-tools, so likely you have grpcio-tools 0.14.0 and grpcio 0.15.0 installed.  The 0.14.0 grpcio-tools release has namespace conflicts with grpcio 0.15.0, which is causing what you are seeing.  A temporary workaround is to uninstall grpcio and grpcio-tools, and then install grpcio-tools and grpcio in that order.

On Thursday, June 30, 2016 at 3:23:28 PM UTC-7, Zachary Deretsky wrote:

Zachary Deretsky

unread,
Jun 30, 2016, 8:12:14 PM6/30/16
to grpc.io
Ken,

thank you, your suggestion resolved this problem.

Zach.

Ken Payson

unread,
Jul 1, 2016, 8:52:53 PM7/1/16
to grpc.io
grpcio-tools 0.15.1 has been released.  If anyone experiences this problem and installed grpcio and grpcio-tools between 2016-06-29 10:08 UTC and 2016-07-02 00:50 UTC, they should re-install both packages.


On Thursday, June 30, 2016 at 3:23:28 PM UTC-7, Zachary Deretsky wrote:
Reply all
Reply to author
Forward
0 new messages