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

Answer from Ananya_Chandraker on Stack Overflow
🌐
Reddit
reddit.com › r/learnpython › i am getting a moduleerror but unsure on how to fix it.
r/learnpython on Reddit: I am getting a ModuleError but unsure on how to fix it.
August 29, 2024 -

I am making a simple YouTube API call where I am getting the statistics of a YouTube channel to learn how to make API Calls.

I am using the Google Python API and have pip installed it into my working directory. I got the ModuleError and then by troubleshooting online I thought of making a virtual environment and installing the google api in there.

After creating the virtual environment and installing the Google API in there I ran the command pip list to make sure that it is in the virtual environment and I get the output:

(playlist_venv) C:\Users\User\OneDrive\Desktop\Playlist_Creator>pip list
Package                  Version
------------------------ --------
cachetools               5.5.0
certifi                  2024.7.4
charset-normalizer       3.3.2
google-api-core          2.19.2
google-api-python-client 2.142.0
google-auth              2.34.0
google-auth-httplib2     0.2.0
googleapis-common-protos 1.65.0
httplib2                 0.22.0
idna                     3.8
pip                      19.2.3
proto-plus               1.24.0
protobuf                 5.27.4
pyasn1                   0.6.0
pyasn1-modules           0.4.0
pyparsing                3.1.4
requests                 2.32.3
rsa                      4.9
setuptools               41.2.0
uritemplate              4.1.1
urllib3                  2.2.2
WARNING: You are using pip version 19.2.3, however version 24.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

My script is as so:

from googleapiclient.discovery import build
import os

api_key = os.environ.get("YT_API_KEY")
if not api_key:
    raise ValueError("YT_API_KEY environment variable not set")
# print(api_key)


youtube = build('youtube',
                'v3',
                developerKey=api_key)

request = youtube.channels().list(
    part='statistics',
    forUsername='******'
)

request = request.execute()

print(request)

And the output is:

(playlist_venv) C:\Users\User\OneDrive\Desktop\Playlist_Creator>python3 youtube_call.py
Traceback (most recent call last):
  File "C:\Users\User\OneDrive\Desktop\Playlist_Creator\youtube_call.py", line 9, in <module>
    from googleapiclient.discovery import build
ModuleNotFoundError: No module named 'googleapiclient'

What am I doing wrong to get this output?

🌐
Reddit
reddit.com › r/learnpython › modulenotfounderror: no module named 'googleapiclient'
r/learnpython on Reddit: ModuleNotFoundError: No module named 'googleapiclient'
August 25, 2020 -

This is my code I'm running in a Python3 Jupyter notebook:

from __future__ import print_function
import datetime
from googleapiclient.discovery import build
from httplib2 import Http
from oauth2client import file, client, tools

import pandas as pd

I get this error:

ModuleNotFoundError: No module named 'googleapiclient'

pip freeze:

This is what I get from the command pip freeze:

apiclient==1.0.4
astroid==2.3.3
attrs==18.1.0
beautifulsoup4==4.7.1
cachetools==4.1.1
certifi==2020.6.20
chardet==3.0.4
colorama==0.4.3
ConfigArgParse==0.14.0
coursera-dl==0.11.4
cycler==0.10.0
entrypoints==0.3
google-api-core==1.22.1
google-api-python-client==1.10.0
google-auth==1.20.1
google-auth-httplib2==0.0.4
google-auth-oauthlib==0.4.1
googleapis-common-protos==1.52.0
httplib2==0.18.1
idna==2.10
isort==4.3.21
keyring==19.0.1
kiwisolver==1.2.0
lazy-object-proxy==1.4.3
matplotlib==3.3.0
mccabe==0.6.1
numpy==1.19.1
oauth2client==4.1.3
oauthlib==3.1.0
pandas==1.1.0
Pillow==7.2.0
protobuf==3.13.0
pyasn1==0.4.8
pyasn1-modules==0.2.8
pylint==2.4.4
pyparsing==2.4.7
python-dateutil==2.8.1
pytz==2020.1
pywin32-ctypes==0.2.0
requests==2.24.0
requests-oauthlib==1.3.0
rsa==4.6
selenium==3.141.0
six==1.15.0
soupsieve==1.9
typed-ast==1.4.1
uritemplate==3.0.1
urllib3==1.25.10
wrapt==1.11.2

I already tried:

  • pip install --force-reinstall google-api-python-client

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

  • Restarting my computer

  • Restart the Jupyter notebook kernel

  • When I try to use the command: "pip install googleapiclient", then I get this error:

ERROR: Could not find a version that satisfies the requirement googleapiclient (from versions: none)
ERROR: No matching distribution found for googleapiclient

What can I do?

🌐
GitHub
github.com › googleapis › google-api-python-client › discussions › 2329
Import "googleapiclient.discovery" could not be resolved · googleapis/google-api-python-client · Discussion #2329
Hello, I'm trying to get started with the YouTube Data API vs in Python but I'm getting: from googleapiclient.discovery import build ModuleNotFoundError: No module named 'googleapiclient'. google-a...
Author   googleapis
🌐
Stack Overflow
stackoverflow.com › questions › 57873824 › from-googleapiclient-discovery-import-build-modulenotfounderror-no-module-named
visual studio - from googleapiclient.discovery import build ModuleNotFoundError: No module named 'googleapiclient' - Stack Overflow
Visual Studio blows the below error: from googleapiclient.discovery import build ModuleNotFoundError: No module named 'googleapiclient' when I am running a script that reads google sheets using...
🌐
GitHub
github.com › googleapis › google-api-python-client › issues › 553
No module named 'apiclient.discovery' · Issue #553 · googleapis/google-api-python-client
August 5, 2018 - Im getting No module named 'apiclient.discovery' error while all dependencies are already installed and updated using pip install --upgrade google-api-python-client oauth2client pip install --upgra...
Author   googleapis
🌐
Reddit
reddit.com › r/jupyternotebooks › modulenotfounderror: no module named 'googleapiclient'
r/JupyterNotebooks on Reddit: ModuleNotFoundError: No module named 'googleapiclient'
August 25, 2020 -

This is my code I'm running in a Python3 Jupyter notebook:

from __future__ import print_function
import datetime
from googleapiclient.discovery import build
from httplib2 import Http
from oauth2client import file, client, tools

import pandas as pd

I get this error:

ModuleNotFoundError: No module named 'googleapiclient'

pip freeze:

This is what I get from the command pip freeze:

apiclient==1.0.4
astroid==2.3.3
attrs==18.1.0
beautifulsoup4==4.7.1
cachetools==4.1.1
certifi==2020.6.20
chardet==3.0.4
colorama==0.4.3
ConfigArgParse==0.14.0
coursera-dl==0.11.4
cycler==0.10.0
entrypoints==0.3
google-api-core==1.22.1
google-api-python-client==1.10.0
google-auth==1.20.1
google-auth-httplib2==0.0.4
google-auth-oauthlib==0.4.1
googleapis-common-protos==1.52.0
httplib2==0.18.1
idna==2.10
isort==4.3.21
keyring==19.0.1
kiwisolver==1.2.0
lazy-object-proxy==1.4.3
matplotlib==3.3.0
mccabe==0.6.1
numpy==1.19.1
oauth2client==4.1.3
oauthlib==3.1.0
pandas==1.1.0
Pillow==7.2.0
protobuf==3.13.0
pyasn1==0.4.8
pyasn1-modules==0.2.8
pylint==2.4.4
pyparsing==2.4.7
python-dateutil==2.8.1
pytz==2020.1
pywin32-ctypes==0.2.0
requests==2.24.0
requests-oauthlib==1.3.0
rsa==4.6
selenium==3.141.0
six==1.15.0
soupsieve==1.9
typed-ast==1.4.1
uritemplate==3.0.1
urllib3==1.25.10
wrapt==1.11.2

I already tried:

  • pip install --force-reinstall google-api-python-client

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

  • Restarting my computer

  • Restart the Jupyter notebook kernel

  • When I try to use the command: "pip install googleapiclient", then I get this error:

ERROR: Could not find a version that satisfies the requirement googleapiclient (from versions: none)
ERROR: No matching distribution found for googleapiclient

What can I do?

Find elsewhere
🌐
Google Groups
groups.google.com › g › google-appengine-stackoverflow › c › Nw2Hqo704C4
ImportError: No module named apiclient.discovery
from googleapiclient.discovery import build ImportError: No module named googleapiclient.discovery Please DO NOT REPLY directly to this email but go to StackOverflow: http://stackoverflow.com/questions/18267749/importerror-no-module-named-apiclient-discovery/37895911#37895911
🌐
Stack Overflow
stackoverflow.com › questions › 58246752 › from-googleapiclient-discovery-import-build-modulenotfounderror-no-module-named
python 3.x - from googleapiclient.discovery import build ModuleNotFoundError: No module named 'googleclient' - Stack Overflow
October 5, 2019 - ImportError: No module named googleapiclient.discovery · 10 · ImportError: cannot import name discovery · 2 · "ModuleNotFoundError : No module named 'apiclient ' " 1 · Cannot import `google` in Python code · 10 · ModuleNotFoundError: No module named 'google' 0 ·
🌐
Itsourcecode
itsourcecode.com › home › modulenotfounderror: no module named ‘google’
Modulenotfounderror: no module named 'google' [SOLVED]
1 week ago - Second, Make sure that you are importing the correct Google module name. The correct import statement for the Google API client library is: from googleapiclient.discovery import build When you are importing the google module, you may try to ...
🌐
Itsourcecode
itsourcecode.com › home › modulenotfounderror: no module named ‘googleapiclient’ [solved]
Modulenotfounderror: no module named 'googleapiclient' [SOLVED]
March 8, 2023 - The Modulenotfounderror: no module named ‘googleapiclient‘ error message means that the Python module ‘googleapiclient’ could not be found or imported.
🌐
PyPI
pypi.org › project › google-api-python-client
google-api-python-client · PyPI
May 27, 2026 - Discovery documents will no longer be retrieved dynamically when you call discovery.build(). The discovery documents will instead be retrieved from the client library directly. New versions of this library are released weekly.
      » pip install google-api-python-client
    
Published   Jun 25, 2026
Version   2.198.0
🌐
DEV Community
dev.to › lameck_oluoch › handling-no-module-named-googleapiclient-in-jupyternotebook-using-python-4lei
Handling - No module named 'googleapiclient' in JupyterNotebook using Python - DEV Community
September 12, 2024 - Handling this error is quite easy, after a long struggle I found out that actually you can install the 'googleapiclient' within a jupyternotebook which contains the project you're working on.
🌐
GitHub
github.com › googleworkspace › python-samples › issues › 175
ModuleNotFoundError: No module named 'googleapiclient' · Issue #175 · googleworkspace/python-samples
August 18, 2020 - Traceback (most recent call last): File "quickstart.py", line 4, in from googleapiclient.discovery import build ModuleNotFoundError: No module named 'googleapiclient'
Author   googleworkspace
🌐
YouTube
youtube.com › luke chaffey
ImportError: No module named googleapiclient.discovery - YouTube
python: ImportError: No module named googleapiclient.discoveryThanks for taking the time to learn more. In this video I'll go through your question, provide ...
Published   January 7, 2024
Views   399