Import "google/api/annotations.proto" was not found or had errors.

5,963 views
Skip to first unread message

Daniela Glikman

unread,
Sep 19, 2021, 11:30:12 AM9/19/21
to grpc.io
Hi,

I'm trying to generate the code in python with grpc_tools, but it doesn't recognize the import. I want to import it so that the API will also be available as restful API.
Is there a python package that will support it?

My proto file is:

syntax = "proto3";

import "google/api/annotations.proto";

service JobOccupations {
rpc GetAllJobOccupations(AllJobOccupationsRequest) returns (AllJobOccupationsResponse) {
option (google.api.http) = {
get: "/jobOccupations"
};
}
}

message AllJobOccupationsRequest {}

message AllJobOccupationsResponse {
repeated JobOccupation jobOccupation = 1;
}

message JobOccupation {
string description = 1;
float salary = 2;
float demand_percentage = 3;
float average_working_hours = 4;
}


Thanks

dfa...@google.com

unread,
Sep 22, 2021, 1:23:25 PM9/22/21
to grpc.io
If you're having problems with the import being found, this is more likely a generic protobuf usage problem, not really specific to gRPC.  Do you have the annotations.proto in your import paths (-I parameter) that you pass on the commandline?

Bartłomiej Najdecki

unread,
Oct 5, 2021, 5:37:51 AM10/5/21
to grpc.io
It seems that you are missing the google-API repository. You can clone it from here and then include it with -I. It is a different project from google/protobuf . Or you can also try to use ready tools like GenDocu to generate the Python SDK for you.
Reply all
Reply to author
Forward
0 new messages