Lewys Gardner
Lewys Gardner

Reputation: 101

ImportError: cannot import name discovery

I am using Google's python API client, and one of the lines it wants you to use is:

from apiclient import discovery

When I run this it returns the error:

ImportError: cannot import name discovery

Note: the apiclient module is installed and up to date

Thanks guys

Upvotes: 10

Views: 18908

Answers (4)

KBurchfiel
KBurchfiel

Reputation: 866

I encountered this issue after seeing the error message "ModuleNotFoundError: No module named 'apiclient'," which prompted me to install apiclient via pip. After realizing this was probably the wrong library, I then instead installed google-api-python-client via conda, which resolved the error message.

(It looks like you were using google-api-python-client all along, but I wanted to share this in case anyone else was also trying to use the apiclient library on pip to execute google-api-python-client tasks.)

Upvotes: 0

Marvelous Ikechi
Marvelous Ikechi

Reputation: 2043

Try this

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

I got the answer from this link: python install module apiclient

Upvotes: 0

Neeraj
Neeraj

Reputation: 119

You should be able to get these dependencies with this simple install:

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

See also: https://stackoverflow.com/a/23521799/1115187

Upvotes: 11

Michał Jabłoński
Michał Jabłoński

Reputation: 1277

At some point apiclient module name was changed. If you cannot import discovery from apiclient, then try:

from googleapiclient import discovery

Hope this helps.

Upvotes: 12

Related Questions