【发布时间】:2017-07-15 22:49:14
【问题描述】:
当我尝试在 Pyspark 中实例化 Spark 会话时,我收到此错误:Exception: Java gateway process exited before sending the driver its port number。这是代码
from pyspark import SparkConf
from pyspark.sql import SparkSession
if __name__ == '__main__':
SPARK_CONFIGURATION = SparkConf().setAppName("OPL").setMaster("local[*]")
SPARK_SESSION = SparkSession.builder\
.config(conf=SPARK_CONFIGURATION)\
.getOrCreate()
print("Hello world")
这是回溯
Neon was unexpected at this time.
Traceback (most recent call last):
File "C:\Users\IBM_ADMIN\Documents\Eclipse Neon for Liberty on Bluemix\OPL_Interface\src\Test\SparkTest.py", line 12, in <module>
.config(conf=SPARK_CONFIGURATION)\
File "C:\Users\IBM_ADMIN\Documents\spark-2.1.0-bin-hadoop2.7\python\pyspark\sql\session.py", line 169, in getOrCreate
sc = SparkContext.getOrCreate(sparkConf)
File "C:\Users\IBM_ADMIN\Documents\spark-2.1.0-bin-hadoop2.7\python\pyspark\context.py", line 307, in getOrCreate
SparkContext(conf=conf or SparkConf())
File "C:\Users\IBM_ADMIN\Documents\spark-2.1.0-bin-hadoop2.7\python\pyspark\context.py", line 115, in __init__
SparkContext._ensure_initialized(self, gateway=gateway, conf=conf)
File "C:\Users\IBM_ADMIN\Documents\spark-2.1.0-bin-hadoop2.7\python\pyspark\context.py", line 256, in _ensure_initialized
SparkContext._gateway = gateway or launch_gateway(conf)
File "C:\Users\IBM_ADMIN\Documents\spark-2.1.0-bin-hadoop2.7\python\pyspark\java_gateway.py", line 95, in launch_gateway
raise Exception("Java gateway process exited before sending the driver its port number")
Exception: Java gateway process exited before sending the driver its port number
我将 PyDev 与 Eclipse Eclipse Neon.2 Release (4.6.2) 一起使用。这是配置: Libraries Environment
注意:我使用的是最新的 Spark 版本:spark-2.1.0-bin-hadoop2.7
我检查了其他几个条目 Pyspark: Exception: Java gateway process exited before sending the driver its port number Spark + Python - Java gateway process exited before sending the driver its port number? 并尝试了大多数建议的修复程序,但错误仍然存在。这对我来说是个障碍,因为在获得 SparkSession 之前我无法测试我的代码。顺便说一句,我也在使用 Java 中的 Spark,但那里没有同样的问题。
这是 Pyspark 中的错误吗?
【问题讨论】:
-
我有同样的错误。虽然只有一个笔记本。我可以在一个笔记本中运行 spark,而在另一个笔记本中出现错误。虽然,两个笔记本都执行相同的代码...
标签: pyspark