【问题标题】:spark_apply Cannot run program “Rscript”: in directory "C:\Users\username\AppData\Local\spark\spark-2.3.3-bin-hadoop2.7\tmp\local\spark-..\userFilesspark_apply 无法运行程序“Rscript”:在目录“C:\Users\username\AppData\Local\spark\spark-2.3.3-bin-hadoop2.7\tmp\local\spark-..\userFiles
【发布时间】:2020-02-21 07:57:51
【问题描述】:

遵循“使用 R 掌握 Apache Spark”一书的第一条说明 关于 spark_apply,在 windows 下的本地集群上并使用 RGui, 启动:

install.packages("sparklyr")
install.packages("pkgconfig")
spark_install("2.3")
Installing Spark 2.3.3 for Hadoop 2.7 or later.
spark_installed_versions()
library(dplyr,sparklyr)
sc <- spark_connect(master = "local", version = "2.3.3")
cars <- copy_to(sc, mtcars)    
cars %>% spark_apply(~round(.x))

返回以下错误:

spark_apply Cannot run program “Rscript”:  in directory "C:\Users\username\AppData\Local\spark\spark-2.3.3-bin-hadoop2.7\tmp\local\spark-..\userFiles-..  
CreateProcess error=2, The file specified can't be found

如何正确安装 sparklyr 和 如何解决这个错误?

【问题讨论】:

    标签: r apache-spark sparklyr


    【解决方案1】:

    spark 节点在其路径中需要 Rscript 可执行文件。对于主节点,它是possible to set the path to the Rscript executable,使用以下命令:

    config <- spark_config()
    config[["spark.r.command"]] <- "d:/path/to/R-3.4.2/bin/Rscript.exe"
    sc <- spark_connect(master = "local", config = config)
    

    让我们找到here 更多关于分布式环境的解释和指南。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-01-07
      • 1970-01-01
      • 2018-12-04
      • 1970-01-01
      • 2021-07-19
      • 2011-10-09
      • 2018-04-28
      • 2020-07-02
      相关资源
      最近更新 更多