0

I'm very new to python and protocol buffer. We've come across a scenario where we have to push metrics to mimir (prometheus). I downloaded and compiled proto definition (https://github.com/grafana/mimir/blob/main/pkg/mimirpb/mimir.proto). There is a line in it:

import "github.com/gogo/protobuf/gogoproto/gogo.proto";

Once the proto is compiled and mimir_pb2 package generated, importing it throws ModuleNotFound Error:

python3
>>> import mimir_pb2
>>> ModuleNotFoundError: from github.com.gogo.protobuf.gogoproto import gogo_pb2 as github_dot_com_dot_gogo_dot_protobuf_dot_gogoproto_dot_gogo__pb2
ModuleNotFoundError, Module github not found.

Compiling mimir.protoc has generated this line in mimir_pb2:

from github.com.gogo.protobuf.gogoproto import gogo_pb2 as github_dot_com_dot_gogo_dot_protobuf_dot_gogoproto_dot_gogo__pb2

Has anyone come across this error before? I'm not sure what/where github.com.gogo.protobuf.gogoproto is/has to be, and how I can resolve the issue.

sfal
  • 1

1 Answers1

0

I found the problem. I also had to download gogo.proto file and compile it. This created gogo_pb2 where I referenced it in the original class.

Python protobuf gRPC generates a dependency that doesn't exist

sfal
  • 1