Search code examples
pythongoogle-apigoogle-api-client

"ModuleNotFoundError : No module named 'apiclient ' "


I recently tried to view Google Calendar using python . To do that I referred Python Quickstart. I did the steps that were mentioned in the website. I completed the second step and downloaded the secretclient.json file. In the terminal I typed in :

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

as I was instructed in the website. I ran the python that was on the website and when I compiled I got the error:

Blockquote Traceback (most recent call last): File "quickstart.py", line 2, in from apiclient import discovery ModuleNotFoundError: No module named 'apiclient'

The Lines which correspond to the error are :

from apiclient import discovery 

Why is the apiclient module unavailable ?


Solution

  • Could it be that you're using a different python version than what the pip installed? For example, if you use python3 to execute the problematic import line, but pip is for python2. Or if you use conda or another python distribution that uses a different path to import the packages from.
    You can verify it if you just open from the command line:

    python
    

    then

    from apiclient import discovery
    

    and check if you still get the error.