googleapis/python-analytics-data

Unable to import packages

elenaparaschiv opened this issue · 2 comments

I completed the steps in readme. When I try running any of the files I get import errors.
For example at quickstart.py on the import line 1 :
from google.analytics.data_v1beta import BetaAnalyticsDataClient
returns the following error
“AttributeError: module 'google.analytics' has no attribute 'data_v1beta'”

In terminal I tried executing :

$ python
>>> import google

>>> google.analytics
<module 'google.analytics' (namespace)>

>>> google.analytics.data_v1beta
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'google.analytics' has no attribute 'data_v1beta'

Screenshot 2022-03-11 at 22 19 24

Hi @elenaparaschiv,

I'm not able to reproduce the issue - the import works as expected for me. Could you try following these steps?

  1. Create virtualenv.
python3 -m venv env
source env/bin/activate
  1. Install google-analytics-data.
pip install google-analytics-data
  1. Run code.
(env) busunkim@busunkim:~/bugs$ python3
Python 3.9.9 (main, Jan 12 2022, 16:10:51) 
[GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from google.analytics.data_v1beta import BetaAnalyticsDataClient
>>> client = BetaAnalyticsDataClient()

Closing for obsolete and not-reproducible.