[Solution] No module named ‘oauth2client’

YOKK m.
2 min readFeb 4, 2020

--

After trying installed by using pip3 — yet, it still showing No module named ‘oauth2client’

Announced on Google Auth Library for Python that oauth2client has been deprecated, then installed google-auth is recommended.

Here is how to do so..

Create new environment

  • cd <desired directory> #i.e. cd Desktop/GA_project
  • pip3 install virtualenv
  • virtualenv <desired_name> # this case GoogleAnalytics_test
    i.e. virtualenv GoogleAnalytics_test
  • source GoogleAnalytics_test/bin/activate
  • GoogleAnalytics_test/bin/pip install google-api-python-client

In your workspace install google-auth (mine — jupyter notebook)

Desktop/GA_project/GoogleAnalytics_test/GA_test.ipnb

From this…

Deprecated !

Replace above (deprecated version) to the code below (credits to Lamroy95’s — Much appreciated!)

from google.oauth2.service_account import Credentials
from googleapiclient.discovery import build

Done!

--

--

YOKK m.
YOKK m.

Written by YOKK m.

a data scientist — Master of Data science is the degree, master of none is also me

No responses yet