3

I'm trying to use the new Google Data Analytics (https://developers.google.com/analytics/devguides/reporting/data/v1). On my local machine I've got this up and running. However on our Python machine I keep getting the folling error.

In from google.analytics.data import AlphaAnalyticsDataClient ModuleNotFoundError: No module named 'google.analytics'

Based on the documentation I had to install google-analytics-data package by using pip. However the problem has nog been solved after installing this package.

Does anyone experience this aswell?

Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449
Ralph
  • 41
  • 1
  • 5

1 Answers1

1

I've found out why this error occurs. I've installed the correct package, but is has been installed into the wrong directory.

Use the following command to install it on the correct directory:

pip install google-analytics-data -t "C:\<python path>\Lib\site-packages"

Read more on this on the following page:

windows pip installing libraries in wrong directory

Ralph
  • 41
  • 1
  • 5
  • Did you follow [this](https://developers.google.com/analytics/devguides/reporting/data/v1#python)? If so and there is an issue with that please submit feedback on the page. The team is in the process of flushing out these documentations they could use some tips where information is lacking. – Linda Lawton - DaImTo Feb 12 '21 at 10:29
  • 1
    @DaImTo Yes I followed the instructions. However I didn't want to setup a virtual environment. So I've installed the google-analytics-data package on the regular Python installation. But somehow the installation of the package ended up on a total different location then expected. On a other sidenote I've missed the documentation of authentication by using the service account json file. By just trying out the following solved my problem AlphaAnalyticsDataClient.from_service_account_json(credientials.json'). The documentation was not really sufficiënt. – Ralph Feb 12 '21 at 12:18
  • 1
    at the top of the page in the blue there is a link to a form "To report an issue with the API, use the " submit your comments when you have a minute, im sure the team would appreciate it. – Linda Lawton - DaImTo Feb 12 '21 at 12:29