【发布时间】:2018-05-14 08:47:20
【问题描述】:
使用以下选项通过 gcloud 控制台创建 Spark 集群
gcloud dataproc clusters create cluster-name --region us-east1 --num-masters 1 --num-workers 2 --master-machine-type n1-standard-2 --worker- 机器类型 n1-standard-1 --metadata spark-packages=graphframes:graphframes:0.2.0-spark2.1-s_2.11
在 spark 主节点上 - 启动 pyspark shell 如下:
pyspark --packages graphframes:graphframes:0.2.0-spark2.0-s_2.11
...
在 spark-packages 中找到 graphframes#graphframes;0.2.0-spark2.0-s_2.11
[成功] graphframes#graphframes;0.2.0-spark2.0-s_2.11!graphframes.jar (578ms)
...
graphframes#graphframes;0.2.0-spark2.0-s_2.11 from spark-packages in [default]
org.scala-lang#scala-reflect;2.11.0 from central in [default]
org.slf4j#slf4j-api;1.7.7 from central in [default]
---------------------------------------------------------------------
| | modules || artifacts |
| conf | number| search|dwnlded|evicted|| number|dwnlded|
---------------------------------------------------------------------
| default | 5 | 5 | 5 | 0 || 5 | 5 |
---------------------------------------------------------------------
...
使用 Python 版本 2.7.9(默认,2016 年 6 月 29 日 13:08:31) SparkSession 可用作“火花”。
>>> from graphframes import *
Traceback(最近一次调用最后一次): 文件“”,第 1 行,在 ImportError:没有名为 graphframes 的模块
如何在 gcloud dataproc spark 集群上加载图框?
【问题讨论】:
-
--packages指定 Java/Scala 包,对吗?是否还需要下载 python 包?如果你必须pip install graphframes,请确保它不依赖于pyspark或py4j包。通过pip安装其中任何一个都将破坏集群上的pyspark:( 相反,只需安装graphframes而不使用这些依赖项。
标签: apache-spark pyspark gcloud google-cloud-dataproc graphframes