尝试通过Jupyter Notebook使用Dataproc从计算机进行访问时,我使用pip安装了所需的库。但是,在导入时出现错误
import google.cloud.dataproc_v1错误信息如下:
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-3-fc8862c62c75> in <module>
----> 1 import google.cloud.dataproc_v1我还尝试了安装包python3 -m pip install google-cloud-dataproc。作为参考,这里是pip list的输出。如有任何建议或帮助,欢迎光临!
Package Version
------------------------ ---------
cachetools 4.1.1
certifi 2020.6.20
chardet 3.0.4
google-api-core 1.22.2
google-auth 1.21.1
google-cloud-dataproc 2.0.0
googleapis-common-protos 1.52.0
grpcio 1.32.0
idna 2.10
libcst 0.3.10
mypy-extensions 0.4.3
pip 20.2.2
proto-plus 1.9.1
protobuf 3.13.0
pyasn1 0.4.8
pyasn1-modules 0.2.8
pytz 2020.1
PyYAML 5.3.1
requests 2.24.0
rsa 4.6
setuptools 45.0.0
six 1.15.0
typing-extensions 3.7.4.3
typing-inspect 0.6.0
urllib3 1.25.10
wheel 0.35.1发布于 2020-09-12 01:39:52
如果您是从notebook中安装的,请在单元中尝试以下操作:
好了!pip安装google.cloud.dataproc_v1
如果由于缺少访问权限而出现错误,请使用--user选项进行尝试,例如
好了!pip安装google.cloud.dataproc_v1 --用户
重新启动内核,然后再次尝试导入库。
发布于 2020-10-01 06:08:15
您能否确认您是在Dataproc上的Jupyter笔记本上运行,以及哪个版本的Dataproc?
我使用Dataproc版本1.5测试了以下在Dataproc notebook上运行的代码
from google.cloud import dataproc_v1
from google.cloud import storage
project_id = 'project'
region = 'us-central1'
cluster_name = 'cluster'
cluster_client = dataproc_v1.ClusterControllerClient(
client_options={"api_endpoint": "{}-dataproc.googleapis.com:443".format(region)}
)
for cluster in cluster_client.list_clusters(request={"project_id": project_id, "region": region}):
cluster_name = cluster.cluster_name
print(f"{cluster_name}")https://stackoverflow.com/questions/63838047
复制相似问题