我尝试在 RStudio 中初始化 Spark 会话
library(SparkR)
spark = sparkR.session()
我得到以下输出:
Spark package found in SPARK_HOME: /opt/application/Spark2/current
Launching java with spark-submit command /opt/application/Spark2/current/bin/spark-submit sparkr-shell /tmp/RtmpHnfhH3/backend_port60069d001e5
Error in sparkR.sparkContext(master, appName, sparkHome, sparkConfigMap, :
Unexpected EOF in JVM connection data. Mismatched versions?
有人知道如何解决这个问题吗?
答案1
使用旧版本的 SparkR,例如 2.3.0 旧消息是:
Version mismatch between Spark JVM and SparkR package. JVM version was 2.2.1-mapr-1803 , while R package version was 2.3.0
所以这似乎是 SparkR 的一个错误,因为旧版本可以完美运行。(我在使用最新版本时也遇到了和你一样的问题)
您可以通过 R 档案获取旧版本(https://cran.r-project.org/src/contrib/Archive/SparkR/) 赶紧跑:
library(devtools)
install_version("SparkR", version = "2.3.0", repos = "http://cran.us.r-project.org")