'Pip install google-cloud-logging failed in docker
I try to search the answer in stackoverflow and try to find something in the github issues but nothing I found. Can anyone give me some tip to solve the problem?
I get the following error when trying to install Google Cloud Logging by pip with docker:
test_web | import google.cloud.logging
test_web | File "/root/site/lib/python3.8/site-packages/google/cloud/logging/__init__.py", line 18, in <module>
test_web | from google.cloud.logging_v2 import __version__
test_web | File "/root/site/lib/python3.8/site-packages/google/cloud/logging_v2/__init__.py", line 25, in <module>
test_web | from google.cloud.logging_v2.client import Client
test_web | File "/root/site/lib/python3.8/site-packages/google/cloud/logging_v2/client.py", line 25, in <module>
test_web | from google.cloud.logging_v2._helpers import _add_defaults_to_filter
test_web | File "/root/site/lib/python3.8/site-packages/google/cloud/logging_v2/_helpers.py", line 25, in <module>
test_web | from google.cloud.logging_v2.entries import LogEntry
test_web | File "/root/site/lib/python3.8/site-packages/google/cloud/logging_v2/entries.py", line 33, in <module>
test_web | from google.iam.v1.logging import audit_data_pb2 # noqa: F401
test_web | File "/root/site/lib/python3.8/site-packages/google/iam/v1/logging/audit_data_pb2.py", line 32, in <module>
test_web | from google.iam.v1 import policy_pb2 as google_dot_iam_dot_v1_dot_policy__pb2
test_web | File "/root/site/lib/python3.8/site-packages/google/iam/v1/policy_pb2.py", line 39, in <module>
test_web | _POLICY = DESCRIPTOR.message_types_by_name["Policy"]
test_web | AttributeError: 'NoneType' object has no attribute 'message_types_by_name'
I have it running in a virtual environment with this in requirements.txt:
google-cloud-logging==3.0.0
Solution 1:[1]
Upgrade your protobuf to 3.20.1. Unsure why its happening. Here's the git issue: https://github.com/googleapis/python-iam/issues/185
Solution 2:[2]
I had the same error while using google-cloud-secret-manager
and poetry
.
Removing unused gcloud
dependency as well as google-cloud-secret-manager
and reinstalling google-cloud-secret-manager
solved it.
poetry remove gcloud
poetry remove google-cloud-secret-manager
poetry add google-cloud-secret-manager
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | BinarSkugga |
Solution 2 | Oded Golden |