Thursday, October 28, 2021

[SOLVED] ModuleNotFoundError: No module named 'google_auth_oauthlib'

Issue

I am trying to run the 'generate_refresh_token.py' file in the authentification folder of the AdWords API.

But when I do python generate_refresh_token.py as described in the documentation, I get the error ModuleNotFoundError: No module named 'google_auth_oauthlib'.

So I try to install the module with pip install google-auth-oauthlib, and here is the output:

Requirement already satisfied: google-auth-oauthlib in /home/$USER/anaconda3/lib/python3.6/site-packages (0.2.0)

I activate my anaconda3 environment by doing source activate /home/$USER/anaconda3/envs/$environment_name. I try to generate the token again with the command above, same error.

Could not find any useful answer or anyone having the same issue with this module. Does anyone have a suggestion I could try?

UPDATE: I have found the error. When I installed the google-auth-oauthlib module via pip, it was installed as a module in the anaconda3 library. But when I run python from the command line, it uses the version from my system, which doesn't have this module.


Solution

I have found the error. When I installed the google-auth-oauthlib module via pip, it was installed as a module in the anaconda3 library. But when I run python from the command line, it uses the version from my system, which doesn't have this module.



Answered By - Thomas