Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ModuleNotFoundError when trying to use BigQuery from google.cloud

So when I run my import statement in my python script, I'd get a ModuleNotFoundError.

    from google.cloud import bigquery
ModuleNotFoundError: No module named 'google'

I've been following https://www.getcensus.com/blog/how-to-hack-it-extracting-data-from-google-bigquery-with-python-2 and I've ran a

pip install --upgrade google-cloud-bigquery

which still hasn't worked

I've tried installing a few other packages from google, but nothing has worked so far.

like image 596
stackoverflowhelp11113 Avatar asked Nov 03 '25 07:11

stackoverflowhelp11113


1 Answers

You have to create a virtual env in your current project, then install the following package with pip :

requirements.txt file

google-api-python-client==2.70.0

In your virtual env, run the following command :

pip install -r requirements.txt

Then you will be able to import the expected elements from the library :

from google.cloud import bigquery

Check your Python version and use Python 3.

like image 182
Mazlum Tosun Avatar answered Nov 04 '25 22:11

Mazlum Tosun



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!