ImportError: No module named 'google'
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
pip install protobuf
pip install google-cloud-translate
And to install the storage service from google google-cloud-storage
, it should be installed separately.
redwolf_cr7
Updated on July 05, 2022Comments
-
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
My scenario is a bit different and I could not find a solution from similar posts here.
-
Jonathan Cross over 5 yearsThis did not work for me (python 3.7, macOS 10.13.6)
-
Darshit Shah over 5 yearsVerify 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 almost 5 yearsThank you! Actually, The key of the solution is Re-install Anaconda only and install it after the cudnn! :P
-
aerin almost 5 yearsI dunno why this works, but it works. pip install google didn't work.
-
joe hoeller about 4 yearswhat does this: "Open Anaconda prompt and point it to Anaconda/Scripts" mean, what are the steps to reproduce this action?
-
Donald almost 4 yearsWas protobuf in my case.
-
Islam Azab over 3 yearsAny ideas why is
google-cloud-bigquery
only available in conda-forge? -
Peter Mortensen about 3 yearsThe link is (effectively) broken. It redirects to the generic page github.com/googleapis/google-api-python-client
-
Saber about 3 yearsThank you @PeterMortensen, I have updated the link
-
CanaryTheBird almost 3 yearsI 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 over 2 yearsThis solved my problem among a lot of other ways.
-
thomas.mac over 2 yearswhy does this work? worked for me
-
kaiya about 2 yearsSeems google doesn't properly handle their requirements.