No module named 'google.cloud._helpers' on GCE

社会主义新天地 提交于 2019-12-11 01:32:31

问题


I get an error when importing google.cloud.bigquery on GCE. It did not happen in an environment that is not GCE. I executed update with pip.

Do you know why?

user1@sv1:~$ python
Python 3.6.0 |Continuum Analytics, Inc.| (default, Dec 23 2016,12:22:00) 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.

>>> from google.cloud import bigquery

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
File "/home/user1/miniconda3/lib/python3.6/site-packages/google/cloud/bigquery/__init__.py", line 34, in <module>
from google.cloud.bigquery.client import Client
File "/home/user1/miniconda3/lib/python3.6/site-packages/google/cloud/bigquery/client.py", line 32, in <module>
import google.cloud._helpers

ModuleNotFoundError: No module named 'google.cloud._helpers'

11/11/2018 add Thank you for answering. It did not work since creating a new python using pyenv ,I think my server is something wrong. I reset the server and try again.


回答1:


In June 2018, Google deprecated the google.cloud Python package. You need to directly use the BigQuery module directly by using pip install --upgrade google-cloud-bigquery, not pip install --upgrade google-cloud.

More info here.




回答2:


Where are you running this script exactly? Have you tried setting up a virtualenv and running it there? It all seems probably related to te Python version or conflicting packages.

For example, running the same from the Cloud Shell works without problem (no need to install any libraries nor use virtualenv in that one for this):

$ python
Python 2.7.13 (default, Sep 26 2018, 18:42:22) 
[GCC 6.3.0 20170516] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from google.cloud import bigquery
>>>


来源:https://stackoverflow.com/questions/53173371/no-module-named-google-cloud-helpers-on-gce

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!