ModuleNotFoundError: No module named 'google‘ when requesting paramaterized query - python

I’ve been running into the same error code when trying to use Python 3.7 to query data from BigQuery. I have enabled the API and also followed instructions on which client libraries to download using the terminal on my MacOS.
I’m not sure what the issue is but each time I try to input the code from google.cloud import bigquery, it returns this error:
ModuleNotFoundError: No module named 'google‘
I am very new to these environments, including python and am not familiar with setting up $PATH for running my parameterized query. A sample of what I’m trying to run could be found here: https://github.com/googleapis/python-bigquery/blob/35627d145a41d57768f19d4392ef235928e00f72/samples/client_query_w_named_params.py
Any help on this would be greatly appreciated. Thank you!

Try install the package again with :
python3 -m pip install --upgrade google-cloud-bigquery
you might want to use python instead of python3, depending on your setup
Had the same error as your, this worked on MacOS
p.s: cannot post to comment due to insufficient reputation
See also: ImportError: No module named google.cloud

Related

BigQuery ImportError: Dlopen(...) library not loaded

I'm trying to use the google.cloud bigquery module, however I keep running into the following error during importing from google.cloud import bigquery
:
ImportError:
dlopen(/Users/rickwilde/opt/anaconda3/envs/summer/lib/python3.8/site-packages/pyarrow/lib.cpython-38-darwin.so, 2):
Library not loaded:
#rpath/libarrow.900.dylib
Referenced from:
/Users/rickwilde/opt/anaconda3/envs/summer/lib/python3.8/site-packages/pyarrow/lib.cpython-38-darwin.so
Reason:
image not found
I've checked in pyawrrow, and there is a file called lib.cpython-38-darwin.so
any help would be greatly appreciated
cheers
I've run into the problem a few times too. From my observations, it happens when an executable or a library depends on another library, then that library is updated to a newer version. For me, simply reinstalling the program/library that gives this error has resolved it every time.
lib-cpython-38-darwin.so looks like it is related to CPython. My best guess would be that you've updated Python, so I'd try reinstalling the google-cloud package first. Like this:
pip install --upgrade --force-reinstall google-cloud
This other Stack Overflow question might also help you.

How to solve GraphQl ImportError - cannot import name 'gql' from 'gql' in Python?

I installed GraphQl on Windows 10 Laptop using the below command:
pip install --pre gql[all]
I tried using the Basic example available on Official Github Page. in my Python IDLE.
However, I am getting this ImportError in my IDLE.
ImportError: cannot import name 'gql' from 'gql'
Kindly help in resolving the issue.
Thanks
make sure the name of your file you're testing with isn't named something similar to a package you're importing. Just got me when I named my file ariadne.py
https://github.com/mirumee/ariadne/issues/400#issue-662473441

Tweet a message using python

i am a newbie in Python and want to try to tweet using python using this code, but after i run it, in python shell said that
from twython import Twython
ModuleNotFoundError: No module named 'twython'
Can someone help what's wrong with my code?
Welcome to Python family! When a module is first imported, Python searches for the module and if found, it creates a module object, initializing it. If the named module cannot be found, a ModuleNotFoundError is raised.
As a beginner, you should learn how to install a package in Python by going through the tutorial: https://packaging.python.org/tutorials/
Next, you should follow the installation guide in
https://twython.readthedocs.io/en/latest/usage/install.html
In the command prompt, you should run
pip install twython
Observe if any error pops up during the installation.
To see if Twython works correctly, start Python in the command prompt,
python
In the Python environment, run the following command:
>>> from twython import Twython
If Twython is installed correctly, you should not see the ModuleNotFoundError.
ModuleNotFoundError means that the module is not installed. Sometimes may be the module is installed but it is installed in a place where python does not look for it. In your case I feel you have not installed twython.
Open command prompt and type the following command
pip install twython
This should install the twython and after this if you run your file the error will not appear.
Check this out for more information on twython https://pypi.org/project/twython/
Firstly, you should try again pip install command,
Also:
If you are using an different place such as Pycharm or Jupyter or Anaconda, you must reinstall that module in that working environments
If you are using python's own ide, try add your current python path to system path
Re-read usage of your module

Import wikipedia from sift.corpora

I'm new to spark and cannot import wikipedia package from sift.corpora.
I'm getting this error. " ImportError: No module named 'sift.corpora ". Here is the notebook I'm working on. Thank you for your help!
https://github.com/wikilinks/sift/blob/master/sift.ipynb
In the first instance this is a python issue and not a spark issue. The error message is telling you that it cannot find the module you want to import. The sift documentation tells you that you have to install the python package before you can use it with:
pip install git+http://git#github.com/wikilinks/sift.git
You have to execute this command on every spark node as spark is a distributed environment.

How do I install the Pygraphics module

I am trying to download the Pygraphics module using Python 2.7.6 and have been heretofore unsuccessful. Below I detail the steps I have taken so far. Any help with this would be most appreciated.
First, I tried the typical install using pip
sudo pip install Pygraphics
When I try to import the module, I receive an error saying ImportError: No module named Pygraphics.
To test whether the module was installed I ran the following code: print sorted(["%s==%s" % (i.key, i.version) for i in pip.get_installed_distributions()]) which showed me all of my installed distributions.
This code returned the following list of all the distributions and clearly showed that Pygraphics is installed:
['altgraph==0.10.2', 'bdist-mpkg==0.5.0', 'bonjour-py==0.3', 'brewer2mpl==1.4', 'certifi==14.05.14', 'datetime==4.0.1', 'flask==0.10.1', 'ggplot==0.6.5', 'ipython==2.0.0-dev', 'itsdangerous==0.24', 'jdcal==1.0', 'jinja2==2.7.3', 'macholib==1.5.1', 'markupsafe==0.23', 'matplotlib==1.4.x', 'mock==1.0.1', 'modulegraph==0.10.4', 'nose==1.3.4', 'numpy==1.9.0.dev-297f54b', 'openpyxl==2.1.2', 'pandas==0.14.1', 'pandasql==0.6.1', 'patsy==0.3.0', 'pika==0.9.14', 'py2app==0.7.3', 'pygments==1.6', 'pygraphics==2.1']
After this, I tried using the GUI installer located on the following Pygrahpics install website. While going through the installer, I received an error message saying "PyGraphics requires System Python 2.7 to install" despite the fact that I have downloaded Python 2.7.6.
At this point I don't know what to do and was hoping someone who may have had a similar issue might be able to help me out.
Thank you for your time.
It looks like you've successfully install PyGraphics. Now import picture :)

Categories