ImportError: no module named apiclient.discovery

I got this error in the Google App Engine Python using the Google Translate API, but I don’t know how to fix it,

<module> from apiclient.discovery import build ImportError: No module named apiclient.discovery 

I will try to install the specified environment, which points to the Google App Engine SDK , and again upload to Google Apps Engine, always get an error ,

Error: server error

The server detected an error and could not fulfill your request. If the problem persists, report your problem and indicate this error message and the request that caused it.

Please tell me how to fix it,

thank

UPDATE: Fixed. Follow Nijjin's help. I fixed the problems by adding the following folders.

apiclient, gflags, httplib2, oauth2client, uritemplate

+79
python google-app-engine google-api-python-client
Aug 16 '13 at 7:10
source share
12 answers

You can get these dependencies with this simple installation:

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

This is described on the quick launch page for python .

+137
May 7 '14 at 15:18
source share

apiclient was the original name of the library.
At some point, he was switched to googleapiclient .

If your code runs on Google App Engine, both should work.

If you run the application yourself, with google-api-python-client installed, both should work.

Although, if we look at the source code of the apiclient package __init__.py module , we will see that the apiclient module was just supported for backward compatibility.

Save apiclient as an alias for googleapiclient.

So, you really should use googleapiclient in your code, since the apiclient alias was just saved so as not to break the legacy code.

 # bad from apiclient.discovery import build # good from googleapiclient.discovery import build 
+60
Jun 12 '15 at 20:24
source share

apiclient not on the list of the third-party library provided by the appengine runtime: http://developers.google.com/appengine/docs/python/tools/libraries27 .

You need to copy apiclient to the project directory and you also need to copy these uritemplate and httplib2 .

Note. Any third-party library that is not in the documentation list should be copied to the appengine project project directory.

+8
Aug 16 '13 at 7:53 on
source share

There is a download for the Google API API Client Library, which contains the library and all its dependencies, named as google-api-python-client-gae- <version> .zip in the project download section. Just unzip it into your App Engine project.

+5
Aug 16 '13 at 11:42 on
source share

For an application engine project, you must install lib locally by typing

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

more details here

+5
Dec 24 '15 at 20:22
source share

I had the same problem due to an error installing the URITemplate module.

This solved the problem:

 pip install --force-reinstall uritemplate.py 
+4
Jul 29 '15 at 18:27
source share

Make sure you only have google-api-python-client installed. If you installed apiclient , this will lead to a collision. So run the following:

 sudo pip uninstall apiclient 
+3
Sep 16 '15 at 17:41
source share

I fixed the problem by reinstalling the package with:

 pip install --force-reinstall google-api-python-client 
+2
Nov 27 '15 at 20:26
source share

"google-api-python-client" requires:

 pip install uritemplate.py 

To fix the problem on the GAE development server:

 from googleapiclient.discovery import build ImportError: No module named googleapiclient.discovery 
+1
Jun 18 '16 at 10:24
source share

I ran into the same problem. This worked:

 >>> import pkg_resources >>> pkg_resources.require("google-api-python-client") [google-api-python-client 1.5.3 (c:\python27), uritemplate 0.6 (c:\python27\lib\site-packages\uritemplate-0.6-py2.7.egg), six 1.10.0 (c:\python27\lib\site-packages\six-1.10.0-py2.7.egg), oauth2client 3.0.0 (c:\python27\lib\site-packages\oauth2client-3.0.0-py2.7.egg), httplib2 0.9.2 (c:\python27\lib\site-packages\httplib2-0.9.2-py2.7.egg), simplejson 3.8.2 (c:\python27\lib\site-packages\simplejson-3.8.2-py2.7-win32.egg), six 1.10.0 (c:\python27\lib\site-packages\six-1.10.0-py2.7.egg), rsa 3.4.2 (c:\python27\lib\site-packages\rsa-3.4.2-py2.7.egg), pyasn1-modules 0.0.8 (c:\python27\lib\site-packages\pyasn1_modules-0.0.8-py2.7.egg), pyasn1 0.1.9 (c:\python27\lib\site-packages\pyasn1-0.1.9-py2.7.egg)] >>> from apiclient.discovery import build >>> 
+1
04 Oct '16 at 20:41
source share

It only worked with me when I used sudo:

 sudo pip install --upgrade google-api-python-client 
0
Sep 25 '17 at 16:46 on
source share

I got the same error while working on a project to analyze the latest calendar events from Google Calendar.

Using a standard installation using pip did not help me, here is what I did to get the packages I needed.

Go directly to the source, here is the link for google-api-python-client , but if you need another language, it should not be too different.

https://github.com/google/google-api-python-client

Click the green "Clone or Download" button in the upper left corner and save it as a zip file. Move the zip to the project folder and extract it there. Then cut all the files from the folder that it creates into the root folder of your project.

Yes, it clutters your workspace, but many compilers have ways to hide files.

After that standard

 from googleapiclient import discovery 

works great.

Hope this helps.

0
Nov 16 '17 at 23:43 on
source share



All Articles