0

I'm trying to configure the Sentry GRPCIntegration in a new project, just as it's described in the docs. When running the application, I get this error:

    from sentry_sdk.integrations.grpc import GRPCIntegration
  File "/usr/local/lib/python3.12/site-packages/sentry_sdk/integrations/grpc/__init__.py", line 11, in <module>
    from .client import ClientInterceptor
  File "/usr/local/lib/python3.12/site-packages/sentry_sdk/integrations/grpc/client.py", line 17, in <module>
    raise DidNotEnable("grpcio is not installed")
sentry_sdk.integrations.DidNotEnable: grpcio is not installed

I'm running my app in a Docker container. I'm in an Apple Silicon machine. I have also tried running the configuration in a Python virtual environment, by running the interpreter. I used the same configuration as in the docs i provided:

import sentry_sdk
from sentry_sdk.integrations.grpc import GRPCIntegration

sentry_sdk.init(
    dsn="https://[email protected]/80959",
    enable_tracing=True,
    integrations=[
        GRPCIntegration(),
    ],
)

with a proper sentry dsn, of course.

And I get the same error.

1 Answer 1

1

Please try installing protobuf

The error arises in sentry_sdk/integrations/grpc/client.py:

try:
    import grpc
    from grpc import ClientCallDetails, Call
    from grpc._interceptor import _UnaryOutcome
    from grpc.aio._interceptor import UnaryStreamCall
    from google.protobuf.message import Message
except ImportError:
    raise DidNotEnable("grpcio is not installed")

The only outlier was from google.protobuf.message import Message which accords with the (misleading?) error.

google.protobuf.message is part of protobuf

Sign up to request clarification or add additional context in comments.

3 Comments

that was it. thanks a lot, there's not enough info around about grpc, kinda hard for we that are new to it!
Ask gRPC questions here and we'll try to help. Using grpcio, you don't generally need to also install protobuf (because grpcio bundles the C++ protobuf implementation). However, because the Sentry SDK specifies the dependency, it really should require it. I filed an issue against the Sentry SDK for Python repo repo.
it seems that because your comment they have fixed it, well done!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.