error when import google.analytics.data_v1beta
wo9999999999 opened this issue · 1 comments
Thanks for stopping by to let us know something could be better!
PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. This will ensure a timely response.
Please run down the following list and make sure you've tried the usual "quick fixes":
- Search the issues already opened: https://github.com/googleapis/python-analytics-data/issues
- Search StackOverflow: https://stackoverflow.com/questions/tagged/google-cloud-platform+python
If you are still having issues, please be sure to include as much information as possible:
Environment details
- OS type and version: Linux-5.15.49-linuxkit-pr-x86_64-with-debian-10.3
- Python version:
python --version
3.7.6 - pip version:
pip --version
20.1.1 google-analytics-data
version:pip show google-analytics-data
Steps to reproduce
- import google.analytics.data_v1beta
- execute the code
Code example
from google.analytics.data_v1beta import BetaAnalyticsDataClient
Stack trace
Traceback (most recent call last):
File "/code/app.py", line 6, in <module>
import dw
File "/code/dw/__init__.py", line 46, in <module>
import dw.google.ga4.fact_website_analytics
File "/code/dw/google/ga4/fact_website_analytics.py", line 6, in <module>
from google.analytics.data_v1beta import BetaAnalyticsDataClient
File "/usr/local/lib/python3.7/site-packages/google/analytics/data_v1beta/__init__.py", line 21, in <module>
from .services.beta_analytics_data import (
File "/usr/local/lib/python3.7/site-packages/google/analytics/data_v1beta/services/beta_analytics_data/__init__.py", line 16, in <module>
from .async_client import BetaAnalyticsDataAsyncClient
File "/usr/local/lib/python3.7/site-packages/google/analytics/data_v1beta/services/beta_analytics_data/async_client.py", line 45, in <module>
from google.analytics.data_v1beta.types import analytics_data_api, data
File "/usr/local/lib/python3.7/site-packages/google/analytics/data_v1beta/types/__init__.py", line 16, in <module>
from .analytics_data_api import (
File "/usr/local/lib/python3.7/site-packages/google/analytics/data_v1beta/types/analytics_data_api.py", line 22, in <module>
from google.analytics.data_v1beta.types import data
File "/usr/local/lib/python3.7/site-packages/google/analytics/data_v1beta/types/data.py", line 177, in <module>
class DateRange(proto.Message):
File "/usr/local/lib/python3.7/site-packages/proto/message.py", line 226, in __new__
field=[i.descriptor for i in fields],
File "/usr/local/lib/python3.7/site-packages/proto/message.py", line 226, in <listcomp>
field=[i.descriptor for i in fields],
File "/usr/local/lib/python3.7/site-packages/proto/fields.py", line 113, in descriptor
proto3_optional=self.optional,
ValueError: Protocol message FieldDescriptorProto has no "proto3_optional" field.
Making sure to follow these steps will guarantee the quickest resolution possible.
Thanks!
Hi @wo9999999999 ,
Based on the stack trace, this error is likely caused by an old version of protobuf
in your environment. The minimum version of protobuf
needed for the latest release of this library is 3.19.5
python-analytics-data/setup.py
Line 42 in 0d2a9aa
To check the current version of protobuf
installed in your environment, run the following code:
import google.protobuf
print(google.protobuf.__version__)
I'm going to close this issue but please feel free to open a new issue with more information.