2017-03-29 91 views
0

我的目標是使用Jupyter Notebook(IPython)和Apache Spark。我使用Apache Toree來做到這一點。我爲SPARK_HOME設置了環境變量,並使用Jupyter配置了Apache Toree安裝。一切似乎都很好。帶Apache Spark的Jupyter Notebook(內核錯誤)

當我運行下面的命令,juypter瀏覽器中打開IPython的筆記本--profile = pyspark

enter image description here

當我選擇阿帕奇Toree - PySpark在下拉菜單中,我不能在我的筆記本代碼,我有這種說法(Python 2裏是OK):

enter image description here

紅色按鈕,得到:

enter image description here

有什麼不對?請幫助 ?

回答

1

不是一個真正的答案,但是如果你沒有迷上toree,只需要一個本地的火花進行學習和實驗,就可以下載一份火花,解壓並在筆記本的開頭使用它:

import os 
import sys 

os.environ['SPARK_HOME']="<path where you have extracted the spark file>" 
sys.path.append(os.path.join(os.environ['SPARK_HOME'], 'python')) 
sys.path.append(os.path.join(os.environ['SPARK_HOME'], 'bin')) 
sys.path.append(os.path.join(os.environ['SPARK_HOME'], 'python/lib/py4j-0.10.4-src.zip')) 

from pyspark import SparkContext,SparkConf 
from pyspark.sql import SQLContext, Row 
import pyspark.sql.functions as sql 


sc = SparkContext() 
sqlContext = SQLContext(sc) 
print sc.version