Siddharth Shukla Siddharth Shukla - 1 year ago 495
Python Question

Python grpc protobuf stubs generation issue: --grpc_out: protoc-gen-grpc: Plugin failed with status code 1

As the question says, I compiled grpc from source and also did

sudo pip install grpcio
, however, the
which grpc_python_plugin
doesn't return anything. This is a problem because the grpc python example for route_guide requires me to run
protoc -I . --python_out=. --grpc_out=. --plugin=protoc-gen-grpc='which grpc_python_plugin' ./route_guide.proto

in order to generate the python stubs. Since,
which grpc_python_plugin
doesn't return anything, I get the following error:

: program not found or is not executable
--grpc_out: protoc-gen-grpc: Plugin failed with status code 1.

If I shorten the command I'm trying to run to:
protoc -I . --python_out=. ./route_guide.proto
, it generates the file but without the Servicer and Stub classes, and server and stub methods. Ofc, these methods are necessary if one wants to use grpc for any purpose. Any help would be appreciated.

Answer Source

It sounds like you don't have /usr/local/bin in your PATH; make install uses a prefix of /usr/local by default. Alternatively, after compilation grpc_python_plugin should be in bins/opt/.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download