How to prevent "ImportError: No module named oauth2client.client" on Google App Engine?

Praxiteles picture Praxiteles · May 16, 2017 · Viewed 53.8k times · Source

We are receiving an error:

ImportError: No module named OAuth2Client

We have noticed scores of questions around this topic, many unanswered and at least one answer that describes the solution of copying over files from the Google App Engine SDK.

This approach, however, seems tedious because all the dependencies are unclear. If we copy over oauth2client then run, the next error is another module that is missing. Fix that, then another module is missing, etc., etc.

What is ironic is that we can see all the files and modules needed, listed from Google App Engine SDK right in PyCharm but they seem inaccessible to the script.

Is there no better way to pull in all the files that oauth2client needs for Python to work on App Engine?

Answer

Sadegh-khan picture Sadegh-khan · Feb 22, 2018

I have this problem and solved by installing oauth2client with pip3:

pip3 install --upgrade oauth2client