简体   繁体   English

导入错误:ApacheBeam 上没有名为“google.cloud”的模块

[英]Import Error: No module named 'google.cloud' on ApacheBeam

I get an import error with importing apache beam's google datastore api.I have one version of Python 3 installed on my Windows 10 64-bit system. I get an import error with importing apache beam's google datastore api.I have one version of Python 3 installed on my Windows 10 64-bit system.

Can somebody help me?有人可以帮助我吗? I have try to solve it but i can't我试图解决它,但我不能

# -*- coding: utf-8 -*-
import apache_beam as beam
from apache_beam.io.gcp.datastore.v1new.datastoreio import ReadFromDatastore, WriteToDatastore
from apache_beam.options.pipeline_options import GoogleCloudOptions
from apache_beam.options.pipeline_options import PipelineOptions

my error message like this我的错误信息是这样的

Traceback (most recent call last):
  File "C:\Work\test.py", line 3, in <module>
    from apache_beam.io.gcp.datastore.v1new.datastoreio import ReadFromDatastore, WriteToDatastore
  File "C:\Work\VENV\venv\lib\site-packages\apache_beam\io\gcp\datastore\v1new\datastoreio.py", line 40, in <module>
    from apache_beam.io.gcp.datastore.v1new import helper
  File "C:\Work\VENV\venv\lib\site-packages\apache_beam\io\gcp\datastore\v1new\helper.py", line 33, in <module>
    from google.cloud import environment_vars
ModuleNotFoundError: No module named 'google.cloud'

Here is pip list这是 pip 列表

Package                  Version
------------------------ ----------
apache-beam              2.17.0
avro-python3             1.9.1
cachetools               4.0.0
certifi                  2019.11.28
chardet                  3.0.4
crcmod                   1.7
dill                     0.3.0
docopt                   0.6.2
fastavro                 0.21.24
future                   0.18.2
google-api-core          1.16.0
google-api-python-client 1.7.11
google-auth              1.10.1
google-auth-httplib2     0.0.3
googleapis-common-protos 1.51.0
grpcio                   1.26.0
hdfs                     2.5.8
httplib2                 0.12.0
idna                     2.8
mock                     2.0.0
numpy                    1.18.1
oauth2client             3.0.0
pbr                      5.4.4
pip                      19.0.3
protobuf                 3.11.2
pyarrow                  0.15.1
pyasn1                   0.4.8
pyasn1-modules           0.2.8
pydot                    1.4.1
pymongo                  3.10.1
pyparsing                2.4.6
python-dateutil          2.8.1
pytz                     2019.3
requests                 2.22.0
rsa                      4.0
setuptools               40.8.0
six                      1.14.0
uritemplate              3.0.1
urllib3                  1.25.7

Please help me with my problem.请帮我解决我的问题。 Thank you before之前谢谢

我安装了 apache-beam[gcp] 并且运行得非常好。

the "google-cloud"-Pacakge are missing.缺少“google-cloud”-Pacakge。

Run:跑:

pip install google-cloud

You need "--requirements_file" flag to your Option on ApacheBeam.您需要在 ApacheBeam 上为您的选项添加“--requirements_file”标志。

as below如下

options = MyOptions(flags = ["--requirements_file", "./requirements.txt"])

I was facing the same issue.我面临着同样的问题。 But later the issue has been solved with the below steps:但后来问题已通过以下步骤解决:

  1. Read following nice article on virtualenv, this will help in later steps,阅读下面关于 virtualenv 的好文章,这将有助于后面的步骤,

  2. Create virtual environment (venv env)创建虚拟环境(venv env)

  3. Activate virtual env激活虚拟环境

  4. Install cloud-dataflow using following link: (this brings in apache_beam) https://cloud.google.com/dataflow/docs/quickstarts/quickstart-python使用以下链接安装 cloud-dataflow:(这会引入 apache_beam) https://cloud.google.com/dataflow/docs/quickstarts/quickstart-python

  5. Run the sample运行示例

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 没有名为 google.cloud 的模块 - No module named google.cloud 来自google.cloud导入firestore ModuleNotFoundError:没有名为&#39;google&#39;的模块 - from google.cloud import firestore ModuleNotFoundError: No module named 'google' 从google.cloud导入bigquery ModuleNotFoundError:没有名为“ google”的模块 - from google.cloud import bigquery ModuleNotFoundError: No module named 'google' 来自google.cloud导入语言ModuleNotFoundError:没有名为“ google.cloud”的模块 - from google.cloud import language ModuleNotFoundError: No module named 'google.cloud' ModuleNotFoundError:没有名为“google.cloud”的模块 - ModuleNotFoundError: No module named 'google.cloud' 没有名为“google.cloud”的模块 Dockerfile python - No module named 'google.cloud' Dockerfile python from google.cloud import Speech_v1 ---- ModuleNotFoundError: No module named &#39;google&#39; - from google.cloud import speech_v1 ---- ModuleNotFoundError: No module named 'google' 尝试从google.cloud导入pubsub时,没有名为service_account的模块 - No module named service_account when trying to import pubsub from google.cloud ModuleNotFoundError:没有名为“google.cloud”的模块,即使我安装了它 - ModuleNotFoundError: No module named 'google.cloud' even though I installed it 无法在 python 脚本中导入 google.cloud 模块 - Can not import google.cloud module in python script
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM