2017-07-27 43 views
0

我需要安裝「plm」包。安裝完成後,「三明治」包丟失了。無法安裝三明治包:安裝包「三明治」具有非零退出狀態

> library(plm) 
Error: package or namespace load failed for ‘plm’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]): 
there is no package called ‘sandwich 

試圖安裝的 「三明治」 包,與此返回:

Installing package into ‘library_path’ 
(as ‘lib’ is unspecified) 
also installing the dependency ‘zoo’ 

There is a binary version available but the source version is later: 
     binary source needs_compilation 
sandwich 2.3-4 2.4-0    FALSE 

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/zoo_1.8-0.zip' 
Content type 'application/zip' length 901864 bytes (880 KB) 
downloaded 880 KB 

package ‘zoo’ successfully unpacked and MD5 sums checked 

The downloaded binary packages are in 
    C:\directory\downloaded_packages 
installing the source package ‘sandwich’ 

trying URL 'https://cran.rstudio.com/src/contrib/sandwich_2.4-0.tar.gz' 
Content type 'application/x-gzip' length 1280592 bytes (1.2 MB) 
downloaded 1.2 MB 

'\\directory\My Documents' 
CMD.EXE was started with the above path as the current directory. 
UNC paths are not supported. Defaulting to Windows directory. 
* installing *source* package 'sandwich' ... 
** package 'sandwich' successfully unpacked and MD5 sums checked 
** R 
** data 
** inst 
** preparing package for lazy loading 
** help 
*** installing help indices 
** building package indices 
** installing vignettes 
Warning in file(con, "w") : 
    cannot open file '\\library_path/sandwich/doc/index.html': No such file or directory 
Error in file(con, "w") : cannot open the connection 
ERROR: installing vignettes failed 
* removing '\\library_path/sandwich' 
Warning in install.packages : 
    running command '"C:/R-34~1.1/bin/x64/R" CMD INSTALL -l "\\library_path" C:\directory/downloaded_packages/sandwich_2.4-0.tar.gz' had status 1 
Warning in install.packages : 
    installation of package ‘sandwich’ had non-zero exit status 

The downloaded source packages are in 
    ‘C:\directory\downloaded_packages’ 

曾試圖:

  1. 重新安裝R和RStudio直接到C(而不是在C:\程序文件)
  2. 使用此命令安裝所有依賴項:

    install.packages("sandwich", dependencies=TRUE)

儘管如此, 「非零退出狀態」 出現了。你有什麼建議嗎?

我使用Windows 7(64位),R 3.4.1和RStudio 1.0.153

+1

嘗試過type =「source」或在全新安裝之前手動刪除庫文件夾? –

+0

導致同樣的錯誤:( 即使現在「動物園」包顯示「非零退出」 – amahido

+0

什麼是'.libPaths()'的輸出?我懷疑RStudio沒有檢測到'C:\ directory \ downloaded_pa​​ckages'作爲一個圖書館的位置 – hongsy

回答

0

我想我找到我的治標不治本的答案。我以前遇到過在R中編寫庫文件夾的權限問題。試圖通過關閉防病毒實時更新,更改R文件夾的安全性等方式解決問題。我認爲這是有效的,因爲我沒有找到再次出現「無法移動臨時安裝....」的問題。但是,當我重新啓動計算機時,問題再次出現。

由於我在一所提供筆記本電腦的大學工作,我需要等到IT部門授予我作爲管理員的訪問權限。在等待它時,我在C:/創建了一個新庫(在我的例子中,我將它命名爲「R庫本地」)。下載所有的包到該庫

install.packages( 「PLM」,依賴= TRUE,LIB = 「C:/ R庫本地」)

而從庫中

庫加載包( 「PLM」,LIB = 「C:/ R圖書館地方」)

它運作良好:)

說不上來,如果我還需要爲R中的文件夾或不圖書館的管理員訪問權限。

+0

是的,它似乎訪問權限導致你的安裝問題,特別是因爲它是一個大學發行的筆記本電腦。會建議將你的庫重命名爲「C:/ R-library-local」(即沒有間距),以防止出現任何編譯問題。 – hongsy

+0

通過檢查答案左側的勾號來回答你的問題 – hongsy

+0

Thanks,@hongsy :) – amahido