【发布时间】:2015-09-26 10:20:46
【问题描述】:
我正在尝试将 IPython notebook 与 Apache Spark 1.4.0 一起使用。我已经按照下面的 2 教程来设置我的配置
Installing Ipython notebook with pyspark 1.4 on AWS
和
Configuring IPython notebook support for Pyspark
配置完成后,相关文件中的代码如下:
1.ipython_notebook_config.py
c=get_config()
c.NotebookApp.ip = '*'
c.NotebookApp.open_browser =False
c.NotebookApp.port = 8193
2.00-pyspark-setup.py
import os
import sys
spark_home = os.environ.get('SPARK_HOME', None)
sys.path.insert(0, spark_home + "/python")
# Add the py4j to the path.
# You may need to change the version number to match your install
sys.path.insert(0, os.path.join(spark_home, 'python/lib/py4j-0.8.2.1-src.zip'))
# Initialize PySpark to predefine the SparkContext variable 'sc'
execfile(os.path.join(spark_home, 'python/pyspark/shell.py'))
我还在我的 .bash_profile 中添加了以下两行:
export SPARK_HOME='home/hadoop/sparl'
source ~/.bash_profile
但是,当我运行时
ipython notebook --profile=pyspark
它显示消息:无法识别的别名 '--profile=pyspark' 它可能没有效果
笔记本好像没有配置pyspark成功 有谁知道如何解决它?非常感谢
以下是一些软件版本
ipython/Jupyter:4.0.0
火花1.4.0
AWS EMR:4.0.0
蟒蛇:2.7.9
顺便说一句,我已经阅读了以下内容,但它不起作用 IPython notebook won't read the configuration file
【问题讨论】:
-
听起来 pyspark 配置文件不存在。文件夹
~/.ipython/profile_pyspark存在吗? -
您好,感谢您的评论。 profile_pyspark 存在。奇怪的是,当我添加 export SPARK_HOME='usr/lib/spark' export Ipython=1 export PYSPARK_PYTHON=/usr/bin/python2.7 export PYSPARK_DRIVER_PYTHON=ipython3 export PYSPARK_DRIVER_PYTHON_OPTS="notebook" 到 .bashrc 并 export PYSPARK_PYTHON= /usr/bin/python2.7 export PYSPARK_DRIVER_PYTHON=ipython3 \n \n to spark-env.sh 一切正常!
标签: python amazon-web-services ipython pyspark