2017-07-27 164 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