Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

protoc with grpc_python_plugin: google/protobuf/any.proto: File not found

I'm running this command:

protoc protobuf/file.proto --proto_path=protobuf --proto_path=protobuf --python_out=out/builtin_pb --grpc_out=out/builtin_pb --plugin=protoc-gen-grpc=/usr/local/bin/grpc_python_plugin

where file.proto has:

syntax = "proto3";

import "google/protobuf/any.proto";

And stuff like:

google.protobuf.Any arg = 3;

However, it has the error:

google/protobuf/any.proto: File not found.
bess_msg.proto: Import "google/protobuf/any.proto" was not found or had errors.
bess_msg.proto:251:3: "google.protobuf.Any" is not defined 
...

Are there any steps I can follow to make sure any.proto is properly installed?

Thanks

like image 618
Marlon Ou Avatar asked Oct 22 '25 14:10

Marlon Ou


1 Answers

I had this error when trying to compile a protobuf to python on Ubuntu. My problem was that I had installed the compiler using sudo apt install protobuf-compiler, but I had not installed the resources using sudo apt install libprotobuf-dev.

Thanks to this answer for showing me the error of my ways.

like image 125
knuckles Avatar answered Oct 27 '25 04:10

knuckles