ImportError: cannot import name 'bigquery_storage_v1beta1' from 'google.cloud' (unknown location)

Viewed 8407

I'm trying to use bigquery_storage to get data from google cloud big query according to this document. However, after install all the modules (including the installation pip install --upgrade 'google-cloud-bigquery[bqstorage,pandas]'), I kept receiving this error:

Traceback (most recent call last):
  File "main.py", line 3, in <module>
    from google.cloud import bigquery_storage_v1beta1
ImportError: cannot import name 'bigquery_storage_v1beta1' from 'google.cloud' (unknown location)

My import code:

import os
from google.cloud import storage
from google.cloud import bigquery
from google.cloud import bigquery_storage_v1beta1

And both bigquery and storage are imported. bigquery storage is indeed installed according to pip show google-cloud-bigquery-storage:

Name: google-cloud-bigquery-storage
Version: 2.0.1
Summary: BigQuery Storage API API client library
Home-page: https://github.com/googleapis/python-bigquery-storage
Author: Google LLC
Author-email: googleapis-packages@google.com
License: Apache 2.0
Location: /home/phuong_anh_nguyen/coop/venv/lib/python3.7/site-packages
Requires: libcst, google-api-core, proto-plus
Required-by:

I'm also in my venv and python version is 3.7. Does anybody know why this happens and how to solve it? I've been uninstalling, reinstalling and upgrading packages for a thousand times in different order and none has worked so far. I had this problem before and somehow it got resolved after maniacally installing packaes. I'm looking for a clear answer at last.

2 Answers

Did you try from google.cloud import bigquery_storage instead? Google docs recommend it.

In order to use bigquery_storage_v1beta1 you should pip install google-cloud-bigquery-storage instead. But it is going to be deprecated soon.

Related