我正在使用来自 jupyter 的 pyspark 和 graphframes。我能够成功导入 pyspark 和 graphframes,但是当我尝试时:
from graphframes.lib import Pregel
我收到以下错误:
ImportError: cannot import name 'Pregel' from 'graphframes.lib'
这篇文章是我如何让 graphframes 工作,但没有 graphframes.lib:
https://github.com/graphframes/graphframes/issues/104
wget https://github.com/graphframes/graphframes/archive/release-0.2.0.zip
unzip release-0.2.0.zip
cd graphframes-release-0.2.0
build/sbt assembly
cd ..
# Copy necessary files to root level so we can start pyspark.
cp graphframes-release-0.2.0/target/scala-2.11/graphframes-release-0-2-0-assembly-0.2.0-spark2.0.jar .
cp -r graphframes-release-0.2.0/python/graphframes .
# Set environment to use Jupyter
export PYSPARK_DRIVER_PYTHON=jupyter
export PYSPARK_DRIVER_PYTHON_OPTS=notebook
# Launch the jupyter server.
pyspark --jars graphframes-release-0-2-0-assembly-0.2.0-spark2.0.jar
我尝试重复上述命令,没有环境行,因为 pyspark 在 jupyter 中对我来说工作得很好,使用不同的版本并且能够获取 graphframes.lib,但没有 Pregel:
wget https://github.com/graphframes/graphframes/archive/release-0.6.0.zip
unzip release-0.6.0.zip
cd graphframes-release-0.6.0
build/sbt assembly
cd ..
# Copy necessary files to root level so we can start pyspark.
cp graphframes-release-0.6.0/target/scala-2.11/graphframes-assembly-0.6.0-spark2.3.jar .
cp -r graphframes-release-0.6.0/python/graphframes .
# Set environment to use Jupyter
export PYSPARK_DRIVER_PYTHON=jupyter
export PYSPARK_DRIVER_PYTHON_OPTS=notebook
# Launch the jupyter server.
pyspark --jars graphframes-assembly-0.6.0-spark2.3.jar
现在我可以看到graphrames.lib 目录,但里面只有aggregate_messages.py。
最后,我尝试了以下但收到 404 错误:
wget https://github.com/graphframes/graphframes/archive/release-0.7.0.zip
我希望,因为我能够导入图形框架,所以我能够从 graphframes.lib 导入 Pregel。似乎在我的版本中,现在是 0.6.0,有一个 graphrames.lib 但没有 Pregel,并且还没有用于 graphframes 的 0.7.0 版本。