Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BigQuery: ImportError due to missing client_pb2 #8674

Closed
shiroyuki opened this issue Jul 15, 2019 · 2 comments
Closed

BigQuery: ImportError due to missing client_pb2 #8674

shiroyuki opened this issue Jul 15, 2019 · 2 comments
Assignees
Labels
api: bigquery Issues related to the BigQuery API. packaging type: question Request for information or clarification. Not an issue.

Comments

@shiroyuki
Copy link

shiroyuki commented Jul 15, 2019

Environment details

OS Affected Python Versions Virtual Environment Used?
MacOS 10.14.5 Python 3.7.0 and 3.7.4 No
→ pip3 list | grep google
google-api-core               1.13.0   
google-auth                   1.5.1    
google-cloud-bigquery         1.17.0   
google-cloud-core             1.0.2    
google-cloud-storage          1.13.0   
google-resumable-media        0.3.1    
googleapis-common-protos      1.5.5

Steps to reproduce

  1. Just try to import bigquery. ImportError is raised at this step.

(Updated: at July 15 11:34 AM EDT)
Please note that:

  • Without using a virtual environment, importing the module is perfectly fine on Debian.
  • Importing the module on MacOS with the virtual environment is ok while doing the same thing on MacOS without the virtual environment raises ImportError.

Code example

from google.cloud import bigquery

Stack trace

Traceback (most recent call last):
  File "zero/mp-118.py", line 1, in <module>
    from google.cloud import bigquery
  File "/usr/local/lib/python3.7/site-packages/google/cloud/bigquery/__init__.py", line 35, in <module>
    from google.cloud.bigquery.client import Client
  File "/usr/local/lib/python3.7/site-packages/google/cloud/bigquery/client.py", line 53, in <module>
    from google.cloud.bigquery.dataset import Dataset
  File "/usr/local/lib/python3.7/site-packages/google/cloud/bigquery/dataset.py", line 24, in <module>
    from google.cloud.bigquery.model import ModelReference
  File "/usr/local/lib/python3.7/site-packages/google/cloud/bigquery/model.py", line 27, in <module>
    from google.cloud.bigquery_v2 import types
  File "/usr/local/lib/python3.7/site-packages/google/cloud/bigquery_v2/__init__.py", line 23, in <module>
    from google.cloud.bigquery_v2 import types
  File "/usr/local/lib/python3.7/site-packages/google/cloud/bigquery_v2/types.py", line 23, in <module>
    from google.cloud.bigquery_v2.proto import model_pb2
  File "/usr/local/lib/python3.7/site-packages/google/cloud/bigquery_v2/proto/model_pb2.py", line 28, in <module>
    from google.api import client_pb2 as google_dot_api_dot_client__pb2
ImportError: cannot import name 'client_pb2' from 'google.api' (/usr/local/lib/python3.7/site-packages/google/api/__init__.py)
@tseaver tseaver added api: bigquery Issues related to the BigQuery API. packaging status: investigating The issue is under investigation, which is determined to be non-trivial. labels Jul 15, 2019
@tseaver
Copy link
Contributor

tseaver commented Jul 15, 2019

I cannot reproduce this in a fresh virtual environment:

$ python3.7 -m venv /tmp/gcp/8674 
$ /tmp/gcp/8674/bin/pip install --upgrade setuptools pip wheel
...
Successfully installed pip-19.1.1 setuptools-41.0.1 wheel-0.33.4
$ /tmp/gcp/8674/bin/pip install google-cloud-bigquery
...
Successfully installed cachetools-3.1.1 certifi-2019.6.16 chardet-3.0.4 google-api-core-1.13.0 google-auth-1.6.3 google-cloud-bigquery-1.17.0 google-cloud-core-1.0.2 google-resumable-media-0.3.2 googleapis-common-protos-1.6.0 idna-2.8 protobuf-3.9.0 pyasn1-0.4.5 pyasn1-modules-0.2.5 pytz-2019.1 requests-2.22.0 rsa-4.0 six-1.12.0 urllib3-1.25.3
$ /tmp/gcp/8674/bin/pip list
Package                  Version  
------------------------ ---------
cachetools               3.1.1    
certifi                  2019.6.16
chardet                  3.0.4    
google-api-core          1.13.0   
google-auth              1.6.3    
google-cloud-bigquery    1.17.0   
google-cloud-core        1.0.2    
google-resumable-media   0.3.2    
googleapis-common-protos 1.6.0    
idna                     2.8      
pip                      19.1.1   
protobuf                 3.9.0    
pyasn1                   0.4.5    
pyasn1-modules           0.2.5    
pytz                     2019.1   
requests                 2.22.0   
rsa                      4.0      
setuptools               41.0.1   
six                      1.12.0   
urllib3                  1.25.3   
wheel                    0.33.4  
$ /tmp/gcp/8674/bin/python -c "from google.cloud import bigquery; print(bigquery.__version__)"
1.17.0

You need to upgrade googleapis-common-protos in your virtual environment.

@tseaver tseaver added type: question Request for information or clarification. Not an issue. and removed status: investigating The issue is under investigation, which is determined to be non-trivial. labels Jul 15, 2019
@tseaver tseaver closed this as completed Jul 15, 2019
@shiroyuki
Copy link
Author

@tseaver It seems to be working after upgrading googleapis-common-protos. Thank you very much for your help. 😄

By the way, should the required version of googleapis-common-protos be at least 1.6.0 to force pip to use the compatible version of the package?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the BigQuery API. packaging type: question Request for information or clarification. Not an issue.
Projects
None yet
Development

No branches or pull requests

2 participants