【问题标题】:Unable to install sandwich package: installation of package ‘sandwich’ had non-zero exit status无法安装三明治包:安装包“三明治”的退出状态非零
【发布时间】:2018-01-03 15:59:45
【问题描述】:

我需要安装“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:\Program Files 中)
  2. 使用此命令安装所有依赖项:

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

仍然出现了“非零退出状态”。你有什么建议吗?

我使用的是 Windows 7(64 位)、R 3.4.1 和 RStudio 1.0.153

【问题讨论】:

  • 尝试过 type = "source" 还是在全新安装之前手动删除库文件夹?
  • 导致同样的错误:(即使现在“动物园”包显示“非零退出”
  • .libPaths() 的输出是什么?我怀疑 RStudio 没有将 C:\directory\downloaded_packages 检测为库位置
  • 嗨@hongsy 它被识别文件夹“C:/R-3.4.1/library”

标签: r install.packages plm


【解决方案1】:

我想我为我的问题找到了一个临时答案。我以前在R中写入库文件夹时遇到了与权限有关的问题。尝试通过关闭防病毒实时更新,更改R文件夹的安全性等来解决问题。我认为它有效,因为我没有找到关于“无法移动临时安装......”的更多问题。但是当我重新启动计算机时,问题又来了。

由于我在大学提供的笔记本电脑中工作,我需要等到 IT 授予我作为管理员的访问权限。在等待它的同时,我在 C:/ 中创建了一个新库(在我的例子中,我将它命名为“R library local”)。将所有包下载到该库

install.packages("plm", dependencies = TRUE, lib = "C:/R library local")

并从库中加载包

library("plm", lib="C:/R library local")

效果很好:)

不知道我是否仍然需要 R 文件夹中库的管理员访问权限。

【讨论】:

  • 是的,访问权限似乎确实导致了您的安装问题,尤其是因为它是大学发行的笔记本电脑。我建议将您的库重命名为“C:/R-library-local”(即没有空格)以防止出现任何编译问题。
  • 勾选答案左侧的勾号,将您的问题标记为已回答。
  • 谢谢,@hongsy :)
猜你喜欢
  • 1970-01-01
  • 2021-04-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2019-01-14
  • 2016-11-25
  • 2020-08-24
相关资源
最近更新 更多