4

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

Marlon Ou
  • 471
  • 1
  • 6
  • 19

2 Answers2

6

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.

knuckles
  • 388
  • 2
  • 9
3

I recently encountered this issue and realized that I was using protobuf 3.0. Simply upgrade the protobuf compiler to the latest version (3.6 in my case) for definitions on those types.

Andy Pan
  • 70
  • 2
  • 7