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 have tried installing it using pip install kmodes and it says that "Requirement is satisfied" but am not being able to import the library even after that.
The list of libraries doesn't have kmodes even after installing. Attaching screenshot for reference. What is happening here?
from kmodes.kprototypes import KPrototypes
ModuleNotFoundError: No module named 'kmodes'
Maybe your PIP is installing to the wrong version of python and the code you are running is being interreted by a later version
Try copying your python executable path and running this
C:\Users\username\AppData\Local\Programs\Python\Python39\python.exe -m pip install kmodes
Another reason is that kmodes did not install properly the first time
Try running this as an administrator
pip uninstall kmodes && pip install kmodes
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.
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'm not experienced in Python, and I need the requests module.
I've tried installing it using pip install requests
The installation went successfully, but when I try to import the module, I get an error like "no module named requests".
Should I add the install location to PYTHONPATH? If yes, how can I find the location where pip installed the files? I don't know about virtualenv, and I am using Ubuntu.
You should install pip for python3 first
How to install pip with Python 3?
then with the pip-3.X install the required module.