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.
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
Use this both installation and then go ahead with your Python code:
pip install google-cloud
pip install google-cloud-vision
I could fix it by installing the following directly.
pip install google.cloud.bigquery
pip install google.cloud.storage
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.
Ref - https://cloud.google.com/python/
Kindly executing these commands,
pip install google
pip install google-api-core
will definitely solve your problem.
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.
I solved the problem in this way:
sudo pip install conda
pip install google
The error got resolved.
I got this from cloud service documentation:
pip install --upgrade google-cloud-translate
It worked for me!
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
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.
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.
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!
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
I too had the same error while trying vision API
from google.cloud import vision
import io
client = vision.ImageAnnotatorClient()
got no module named 'google'
so I added a line
import google
in such a way,
import google
from google.cloud import vision
import io
client = vision.ImageAnnotatorClient()
and it worked for me.:)
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.
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.
Related
I tried to import Tensorflow Data Validation library via the below command in Google Colab.
import tensorflow_data_validation as tfdv
It gave me this error:
ModuleNotFoundError: No module named 'tensorflow_data_validation'
I tried to install the library using pip via below commands. But couldn't install the package successfully.
pip install tensorflow-data-validation
pip install tensorflow-data-validation==1.3.0
pip install --upgrade --force-reinstall tensorflow-data-validation[all]
How to resolve this issue?
To install the library properly, follow these steps:
Install the library using pip:
!pip install tensorflow-data-validation
Reload the environment. A button will show up at the end of the previous cell to Restart, but you can also do it with Ctrl+M or using the menu: "Runtime" > "Restart Runtime".
Import the library as usual:
import tensorflow_data_validation as tfdv
Why do I need to reload the environment? It's because installing tensorflow-data-validation upgrades one of the libraries already present in your Colab environment. So, to "activate" the new environment and use the newly installed libraries and their installed versions you need to reload the environment
I was able to resolve this error by installing tensorflow_data_validation library via the below command. Now I'm able to use this library in my Colab file.
!pip install -U tensorflow \
tensorflow-data-validation \
apache-beam[gcp]
I am trying to install minieigen python3 package in google colab.
I've been trying to install it through pip but there is lot of dependancies and after few hours of trying figure out what else is missing, I just gave up.
There is second option to install it using apt-get - apt-get install python3-minieigen. That one is fine, but I cannot import it in python later on. I've checked sys.path and it looks ok. Here is screenshot with path of installed package and sys.path.
Here is the snippet with commands that I am using:
!apt-get install python3-minieigen
!pip install minieigen
import minieigen
import sys
sys.path
I would appreciate any way of installing this package on google colab.
I'm trying to install the avro package for confluent-kafka with python3 on macOs Sierra.
Installing the confluent-kafka package works fine, no issues. The problem is when I try to install the avro package:
pip install confluent-kafka[avro]
I just get an error message from the bash, saying:
no matches found: confluent-kafka[avro]
How can I install this package? Anyone else that have managed to do it on mac?
Assuming you are not using bash (in my case it was zsh), the [] might mess with your shell. The following should solve this:
pip install "confluent-kafka[avro]"
For me this worked with the default install from pypi, no need for the github URL.
Try installing directly from github
pip install git+git://github.com/confluentinc/confluent-kafka-python.git
Solved! In my case it was python version
I was using python 3.10.1 version
Uninstall python 3.10.1 and python Launcher from add or remove programs
Download python 3.7.0 for x64 bit using this link or download from here Link
Now you can: pip install confluent-kafka[avro]
New to python, and trying to install a module "apiclient"
since my ide pycharm does not recognize that import:
from apiclient.discovery import build
what I tried:
pip install apiclient
download manually the package from
https://developers.google.com/api-client-library/python/start/installation#system-requirements
then I extracted it into
/Users/nirregev/anaconda/bin/google-api-python-client-1.5.0
and ran this on my mac terminal
python setup.py install
but still pycharm does not recognize this module.
According to pycharm I have the following interpreters installed:
/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5
/Users/nirregev/anaconda/bin/python
/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
Try this:
sudo pip install --upgrade google-api-python-client
OR
Make sure you only have google-api-python-client installed. If you have apiclient installed, it will cause a collision. So, run the following:
pip install --force-reinstall google-api-python-client
Answer Source
I ran into this problem and had a tough time figuring it out. In the end, this worked for me:
pip install google-api-python-client==1.5.3
Before doing this, I had version 1.6.2 installed. What I think is going on is that later versions of google-api-python-client dropped the apiclient in favor of the googleapiclient alias; which is an issue because some packages (e.g. airflow) still use that apiclient.discovery import.
Hope this helps.
If you have python3 installed somewhere and you are to install apiclient, it may be installing it in your python3 directory. I had the same problem and when I uninstalled python3 my program ran smoothly.
If you have got both python 2 and python 3 and you're trying to use python 2 for this purpose try the following: sudo pip2 install google-api-python-client==1.5.3 . This worked for me.
I am on Mac, using brew's python, and this worked for me:
1 - As suggested by others, install the API client using pip:
sudo pip install --upgrade google-api-python-client
2 - Make sure you are calling the library in your code as googleapiclient, and not as apiclient, which is deprecated.
3 - Tell Python to look for packages in the pip folder:
export PYTHONPATH=/usr/local/lib/python2.7/site-packages
To make it permanent, add the above line to either your .profile or .bash_profile file in your $HOME.
I know there are many posts on this, and I've tried using the solutions provided, but to no avail. I tried pip install requests and pip install requests --upgrade:
pip install requests --upgrade
You are using pip version 7.1.0, however version 7.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Requirement already up-to-date: requests in /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages
I then tried running pip install --upgrade pip, yet when I run my file I still get
Import Error: No module named requests
I am able to use requests in PyCharm, so I don't know what's causing this. Can someone please help?
You installed requests into a different Python installation. The /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages is the site-packages directory for the Mac OS X /usr/bin/python installation.
PyCharm is not currently configured to use that Python installation; check what Python is being used either by looking at your PyCharm settings, or by asking Python directly with:
import sys
print(sys.executable)
Note that PyCharm can handle package installations for you as well; rather than use the command line pip consider using PyCharm, as it'll use the currently configured Python installation in that case.
install package name "request" from pychram package setting. then it will be work fine.
If you are having this issue in Pycharm and you have configured your Pycharm to create projects in virtual environments, then you can use the Terminal in Pycharm to run the
pip3 install requests
to resolve this issue. This is by design to ensure you control dependencies.