【问题标题】:Unable to import graphframes in pyspark shell on gcloud dataproc spark cluster无法在 gcloud dataproc spark 集群上的 pyspark shell 中导入图框
【发布时间】: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,请确保它不依赖于pysparkpy4j 包。通过pip 安装其中任何一个都将破坏集群上的pyspark :( 相反,只需安装graphframes 而不使用这些依赖项。

标签: apache-spark pyspark gcloud google-cloud-dataproc graphframes


【解决方案1】:

似乎是一个已知问题,您必须跳过箍以使其在 pyspark 中工作:https://github.com/graphframes/graphframes/issues/238https://github.com/graphframes/graphframes/issues/172

【讨论】:

    猜你喜欢
    • 2016-04-19
    • 1970-01-01
    • 1970-01-01
    • 2016-01-26
    • 1970-01-01
    • 1970-01-01
    • 2017-10-30
    • 1970-01-01
    • 2021-02-21
    相关资源
    最近更新 更多