ImportError: No module named 'google'

230,666

Solution 1

I figured out the solution:

  • I had to delete my Anaconda and Python installations
  • Re-install Anaconda only
  • Open the Anaconda prompt and point it to Anaconda/Scripts
  • Run pip install google
  • Run the sample code now from Spyder.

No more errors.

Solution 2

According to https://github.com/googleapis/google-api-python-client#installation, you need to install the google-api-python-client package:

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

Solution 3

Use this both installation and then go ahead with your Python code:

pip install google-cloud
pip install google-cloud-vision

Solution 4

I could fix it by installing the following directly.

pip install google.cloud.bigquery
pip install google.cloud.storage

Solution 5

I faced the same issue, and I was trying to import translate from google.cloud, but I kept getting the same error.

This is what I did

  1. pip install protobuf
  2. pip install google-cloud-translate

And to install the storage service from google google-cloud-storage, it should be installed separately.

Ref - https://cloud.google.com/python/

Share:
230,666
redwolf_cr7
Author by

redwolf_cr7

Updated on July 05, 2022

Comments

  • redwolf_cr7
    redwolf_cr7 almost 2 years

    I installed Python 3.5. I ran the pip install google command and verified the modules. Google was present.

    I installed Anaconda 3.5 and tried to run z sample code. But I'm getting the import error. Please find the screen shot attached. What am I missing? Do I have to link my Spyder to Python installation directory in some way? Why is Spyder unable to google module?

    My Python installation directory: C:\Users\XXX\AppData\Local\Programs\Python\Python35

    Enter image description here

    Enter image description here

    My scenario is a bit different and I could not find a solution from similar posts here.

  • Jonathan Cross
    Jonathan Cross over 5 years
    This did not work for me (python 3.7, macOS 10.13.6)
  • Darshit Shah
    Darshit Shah over 5 years
    Verify first whether you have package installed through PIP or not? If Yes, then please check the Directory path and if not then you have to again use the above 2 commands to install it
  • Mohammad Javad
    Mohammad Javad almost 5 years
    Thank you! Actually, The key of the solution is Re-install Anaconda only and install it after the cudnn! :P
  • aerin
    aerin almost 5 years
    I dunno why this works, but it works. pip install google didn't work.
  • joe hoeller
    joe hoeller about 4 years
    what does this: "Open Anaconda prompt and point it to Anaconda/Scripts" mean, what are the steps to reproduce this action?
  • Donald
    Donald almost 4 years
    Was protobuf in my case.
  • Islam Azab
    Islam Azab over 3 years
    Any ideas why is google-cloud-bigquery only available in conda-forge?
  • Peter Mortensen
    Peter Mortensen about 3 years
    The link is (effectively) broken. It redirects to the generic page github.com/googleapis/google-api-python-client
  • Saber
    Saber about 3 years
    Thank you @PeterMortensen, I have updated the link
  • CanaryTheBird
    CanaryTheBird almost 3 years
    I have the same question. What does "point it to Anaconda/Scripts" mean? I had opened my Anaconda prompt but did not know what to do to "point it to Anaconda/Scripts".
  • ibrahim koz
    ibrahim koz over 2 years
    This solved my problem among a lot of other ways.
  • thomas.mac
    thomas.mac over 2 years
    why does this work? worked for me
  • kaiya
    kaiya about 2 years
    Seems google doesn't properly handle their requirements.