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:UsersXXXAppDataLocalProgramsPythonPython35
My scenario is a bit different and I could not find a solution from similar posts here.
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
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
Method 2
Use this both installation and then go ahead with your Python code:
pip install google-cloud pip install google-cloud-vision
Method 3
I could fix it by installing the following directly.
pip install google.cloud.bigquery pip install google.cloud.storage
Method 4
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 protobufpip 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/
Method 5
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.
Method 6
I solved the problem in this way:
sudo pip install condapip install google
The error got resolved.
Method 7
I got this from cloud service documentation:
pip install --upgrade google-cloud-translate
It worked for me!
Method 8
Kindly executing these commands,
pip install google pip install google-api-core
will definitely solve your problem.
Method 9
I found a similar error when I tried to access the bigquery from google.cloud.
from google.cloud import bigquery
The error was resolved after I installed the google.cloud from conda-forge community.
conda install -c conda-forge google-cloud-bigquery
Method 10
I had a similar import problem. I noticed that there was no __init__.py file in the root of the google package. So, I created an empty __init__.py and now the import works.
Method 11
What solved it for me was uninstalling Anaconda (in my case, Spyder), install the required google clients (google-api-python-client will do), then reinstall Anaconda.
This should solve it!
Method 12
I know its frustrating to make it done. Its not hit and try to be honest.
first step to setup google apis
pip install --upgrade google-api-python-client
second- look and read your DAG and see what is source/destination or other GCP platform you are using such as if you are taking data from bigquery then
pip install bigquery or pip install xyz-google-stuff
Method 13
For Python-Flask application.
If nothing helps,
- Uninstall flask (pip uninstall flask)
- Uninstall python from your machine
- Restart the machine and make sure uninstall is done properly
- Re-install python and flask again
- Run
pip install --upgrade google-api-python-client - Run your application
It should be working fine now.
Method 14
- Close Anaconda/Spyder
- Open command prompt and run the below command
- conda update –all
- Start the app again and this time it should work.
Note – You need not have to uninstall/reinstall anything.
Method 15
Kindly executing these commands
If you are using the python2 version:
- pip install google
- pip install google-api-core
If you are using the python3 version:
- pip3 install google
- pip3 install google-api-core
will definitely solve your problem.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

