pythongoogle-analyticsgoogle-apigoogle-analytics-data-api

Python ModuleNotFoundError: No module named 'google.analytics'


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?


Solution

  • 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