Reputation: 442
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.
Upvotes: 23
Views: 60465
Reputation: 1
I was using pycharm and for me it kept showing this error, to a point i reinstalled everything.
For me what i did was i made a requirements.txt
and put the required package/library there and then on my main.py
file it showed a prompt that these are missing (even though it showed in terminal that successfully installed before when the error was occurring continually)
Then i also updated pip and again retried manually installing requirements.txt using pip install -r requirements.txt
This finally worked, I am not sure if pip was a problem or whatever. I do not know why this keeps occurring again and again. if someone do get to know please do let me know.
Upvotes: 0
Reputation: 1
Activate your virtual environment and install the module there.It will works
Upvotes: 0
Reputation: 2693
I was in a situation where installing using pip install google-auth-oauthlib
worked, but I was still seeing ModuleNotFoundError you mention above.
I tried the approach of installing via sudo pip install google-auth-oauthlib
. That didn't work, and I kept seeing ModuleNotFoundError: No module named 'pip._internal.cli.main
.
If anyone else is in the same boat, I was able to successfully install using pip3 install google-auth-oauthlib
(oddly enough, pip3
and pip
both point to the same location for me: pip 21.2.4
).
Upvotes: 4
Reputation: 442
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.
Upvotes: 6
Reputation: 19259
If you use conda
instead of pip
:
conda install google-auth google-auth-oauthlib
Upvotes: 12
Reputation: 393
I had the same issue. Was resolved by using:
sudo pip install google-auth-oauthlib
the sudo was necessary, not sure why, maybe someone else can eleborate.
Upvotes: 29