2015-08-28 35 views
2

我已經安裝了Spark-1.4.1(具有R 3.1.3版本)。目前正在測試SparkR以運行統計模型。我能夠運行一些示例代碼,例如,如何在64位模式下運行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() 

所以接下來,我到SparkR安裝rJava包。但它沒有安裝。給出以下錯誤。

> 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' 

而且當,我跑在它開始作爲32位應用程序殼SparkR命令。我突出顯示了版本信息如下。 enter image description here

所以,請幫我解決這個問題。

+1

我無法重現您的32位應用程序。你嘗試過使用香草R會話並加載SparkR嗎? – csgillespie

+0

我沒有使用香草R會話。我會嘗試通過香草R會議。 –

回答

0

我解決了這個問題。這是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. 

enter image description here

感謝大家的支持!

2

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」
  • 你不想把包放在那裏。

你有兩個選擇,

  • 啓動香草R對話,並照常安裝
  • 或者,使用install.packageslib參數來指定要安裝rJava
相關問題