14

I have python webapp2 application but when I run it I get this error

ImportError: No module named googleapiclient.discovery

what I found in stackoverflow is

ImportError: No module named apiclient.discovery

I tried to do what people said but it did not work

EDIT:

pip freeze

enter image description here

Bill
  • 2,494
  • 5
  • 26
  • 61
Ali Al-ali
  • 199
  • 1
  • 2
  • 11
  • What is the output of running `pip freeze` in your terminal? Update your answer with it – Jessie Mar 24 '17 at 22:26
  • it is uploaded now – Ali Al-ali Mar 24 '17 at 22:36
  • You should make sure you are properly following the process for [installing a third-party library](https://cloud.google.com/appengine/docs/standard/python/tools/using-libraries-python-27#installing_a_third-party_library). – Yannick MG Aug 02 '17 at 16:09
  • 1
    Possible duplicate of [ImportError: No module named apiclient.discovery](https://stackoverflow.com/questions/18267749/importerror-no-module-named-apiclient-discovery) – Kenworth Nov 08 '17 at 17:25

7 Answers7

24

This is resolved in another thread: ImportError: No module named apiclient.discovery

Also this one worked in our case

pip install --upgrade google-api-python-client

Using python 3.6.5

Salma Elshahawy
  • 1,112
  • 2
  • 11
  • 21
Ananya_Chandraker
  • 409
  • 1
  • 5
  • 11
  • Just wanted to add a small detail, that you could add "python -m" before the pip command, if you have Python installed and Pip is not recognized. – Brookie_C Oct 15 '21 at 19:28
4

If your a Windows User and have Python Installed, then use the following command:

python -m pip install --upgrade google-api-python-client
Brookie_C
  • 427
  • 2
  • 10
1

I had the same issue. I am using the requirements.txt to install the libraries. My requirements.txt had google-api-python-client==1.6.2 and pip install was not installing the lib. I got rid of the version and have only google-api-python-client in the requirements.txt. After that i ran the pip install again and appengine app worked after that.

debtmantra
  • 39
  • 3
0

Struggled with this issue for quite a while, trying to deploy on Heroku ( App worked locally). For me, the requirements.txt file had both google-api-python-client==1.6.2 and oauth2client==4.0.0 . I seemed to have resolved it by basically deleting the app and redeploying after removing the version data of google-api-python-client, and deleting oauth2client==4.0.0. Alternatively, you could try manually uninstalling google-api-python-client and all dependencies, and reinstalling them.

0

Google App Engine + Flask App Deployment

My App works fine when locally. But I got this error when I was deploying the Flask app on Google App Engine. The reason was that I did not add google-api-python-client in requirement.txt

AFAIK Google app engine downloads all the dependency you pip installed. In order to run the python app, the App engine must know what libraries are needed to run your app.

So add all libraries in requirement.txt file.

Here is what my requirement.txt looks like

Flask==1.1.2
gunicorn==19.3.0
google-api-core==1.21.0
google-api-python-client==1.10.0
Rohit Singh
  • 16,950
  • 7
  • 90
  • 88
0

Best way is to create a folder named "python" and install dependencies using windows sub-system for linux, zip the folder(give same name "python") and create an aws lambda layer for reusability.

commands:

mkdir python

cd python

pip install google-api-python-client -t .

pip install apiclient -t .

pip install oauth2client -t .

0

Use:

pip install google-api-python-client

See https://pinter.org/archives/10926 for more information.

S.B
  • 13,077
  • 10
  • 22
  • 49