【问题标题】:How to run sparkR in 64-bit mode如何在 64 位模式下运行 sparkR
【发布时间】:2015-11-22 18:52:26
【问题描述】:

我已经安装了 Spark - 1.4.1(有 R 3.1.3 版本)。目前正在测试 SparkR 以运行统计模型。我可以运行一些示例代码,例如,

Sys.setenv(SAPRK_HOME = "C:\\hdp\\spark-1.4.1-bin-hadoop2.6")
.libPaths(c(file.path(Sys.getenv("SPARK_HOME"), "R", "lib"), .libPaths()))
#load the Sparkr library
library(SparkR)
# Create a spark context and a SQL context
sc <- sparkR.init(master = "local")

sqlContext <- sparkRSQL.init(sc)

#create a sparkR DataFrame
DF <- createDataFrame(sqlContext, faithful)

sparkR.stop()

接下来,我将rJava 包安装到SparkR。但它没有安装。给出以下错误。

> install.packages("rJava")
Installing package into 'C:/hdp/spark-1.4.1-bin-hadoop2.6/R/lib'
(as 'lib' is unspecified)
trying URL 'http://ftp.iitm.ac.in/cran/bin/windows/contrib/3.1/rJava_0.9-7.zip'
Content type 'text/html; charset="utf-8"' length 898 bytes
opened URL
downloaded 898 bytes

Error in read.dcf(file.path(pkgname, "DESCRIPTION"), c("Package", "Type")) :
  cannot open the connection
In addition: Warning messages:
1: In unzip(zipname, exdir = dest) : error 1 in extracting from zip file
2: In read.dcf(file.path(pkgname, "DESCRIPTION"), c("Package", "Type")) :
  cannot open compressed file 'rJava/DESCRIPTION', probable reason 'No such file or directory'

另外,当我在 shell 上运行 SparkR 命令时,它会作为 32 位应用程序启动。我突出显示了版本信息,如下所示。

所以,请帮我解决这个问题。

【问题讨论】:

  • 我无法重现您的 32 位应用程序。您是否尝试过使用 vanilla R 会话并加载 SparkR?
  • 我没有使用 vanilla R 会话。我会尝试香草 R 会话。

标签: r apache-spark sparkr rhadoop


【解决方案1】:

当在SparkR shell 中时,它似乎改变了安装 R 包的位置。关键是

Installing package into 'C:/hdp/spark-1.4.1-bin-hadoop2.6/R/lib'

我怀疑

  • 您没有 `C:/hdp/spark-1.4.1-bin-hadoop2.6/R/lib' 的写入权限
  • 你一开始就不想把包放在那里。

你有两个选择,

  • 启动 vanilla R 会话并照常安装
  • 或者,使用install.packages 中的lib 参数来指定要安装rJava 的位置

【讨论】:

    【解决方案2】:

    我解决了这个问题。这是 R 版本问题,之前我使用的是 R 3.1.3。当时它给了我错误,rJava 包不适用于当前 R 版本。

    To solve I follow this steps:
    1) Installed new R version i.e R 3.2.2
    2) Then update the Path variable and new R version path(Windows -> "Path" -> "Edit environment variables to for your account" -> PATH -> edit the value.)
    3) Again restart sparkR shell.
    

    感谢大家的支持!!!

    【讨论】:

      猜你喜欢
      • 2014-05-16
      • 2012-11-23
      • 1970-01-01
      • 2011-02-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-07-02
      • 2014-07-23
      相关资源
      最近更新 更多