Unable to install sandwich package: installation of package ‘sandwich’ had non-zero exit status

筅森魡賤 提交于 2019-12-11 15:15:59

问题


I need to install the "plm" package. After installing it, the "sandwich" package was missing.

> 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

Tried to install the "sandwich" package, returned with this:

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’

Had tried:

  1. Reinstall R and RStudio directly to C (not in C:\Program Files)
  2. Using this command to install all the dependencies:

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

Still, the "non-zero exit status" appeared. Do you have any suggestions?

I am using Windows 7 (64 bit), R 3.4.1 and RStudio 1.0.153


回答1:


I think i found a temporary answer for my problem. I previously had problems related to the privilege in writing the library folder in R. Tried to work around by turning off anti-virus live update, change the security of the R folder, etc. I thought it was worked, since I did not find anymore issues on "unable to move temporary installation....". But when I restart my computer, the problem came again.

Since I am working in a university provided laptop, I need to wait until the IT grants me access as an admin. While waiting for it, I created a new library in C:/ (in my case, I named it as "R library local"). Downloaded all the package to that library

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

And load the package from the library

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

It works well :)

Dunno if I still need the admin access for the library in R folder or not.



来源:https://stackoverflow.com/questions/45358976/unable-to-install-sandwich-package-installation-of-package-sandwich-had-non-z

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!