Import Error: No Module named google.auth

12,783 views
Skip to first unread message

Melanie Li

unread,
Apr 19, 2019, 9:03:16 AM4/19/19
to Google App Engine
Hello,

I'm trying to use the Google Calendar API with GAE standard environment Python 2.7.

However I'm facing this issue that I cannot import the google.auth library.
No matter what I did like adding the lib, or manually put the library in the project folder, it just cannot recognize the library at all.

I think this is because there's a conflict between the Google App Engine API because if I rename the library it's working somehow. But I don't think that's the right way to do it.

Can anyone please give me some instructions or is it supported for Python 2.7 with GAE standard environment and the Calendar API or any of the G-suite API?

Thank you very much for your help.

George (Cloud Platform Support)

unread,
Apr 21, 2019, 3:59:17 PM4/21/19
to Google App Engine
Hello Melanie, 

Have you installed Client Libraries with pip install --upgrade google-api-python-client google-auth-httplib2 google-auth-oauthlib? You can find related detail on the "Python Quickstart" documentation page

Melanie Li

unread,
Apr 22, 2019, 7:55:17 AM4/22/19
to Google App Engine
Hi George,

Thank you for your reply!

Yes I did - but still getting the error: No module named auth.transport.requests (or no module named google.auth if we import google.auth)
The thing is if I renamed module google to other name, it can at least find the auth, that's why I'm wondering if that's because the name is conflict with app engine API google (google.appengine for example)?
I'm now using the standard environment but if it only works for flexible environment I can also try that. I followed the instruction in the document but this error is popping up all the time and it's really not working at all.

Thanks,
Melanie

yka...@google.com

unread,
Apr 24, 2019, 1:27:35 PM4/24/19
to Google App Engine
I suggest posting this on Stackoverflow and including snippets of your import code along with the full error you are receiving since it it better suited for development issues. It is a bit hard to diagnose this at this point.

Dan Gilmour

unread,
May 28, 2019, 4:44:55 PM5/28/19
to Google App Engine
I'm having the same problem, have you found any solution?

Phillip Pearson

unread,
May 28, 2019, 9:08:49 PM5/28/19
to google-a...@googlegroups.com
The problem here might be that App Engine already includes a 'google' module, so if you want to vendor in something else in the google namespace, you need to add it to google.__path__.

For example if your google.auth module is lib/google/auth, you should do this in appengine_config.py:

import google
google.__path__.append('lib/google')

That will tell Python to look under lib/google as well as in the google folder that's part of the App Engine runtime.

Cheers,
Phil

On Tue, May 28, 2019 at 1:44 PM Daniel Gilmour <danielgi...@gmail.com> wrote:
I'm having the same problem, have you found any solution?

--
You received this message because you are subscribed to the Google Groups "Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-appengi...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-appengine/08e09a01-5041-4e57-a94d-f9959c4b5dee%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages