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

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:
Reinstall R and RStudio directly to C (not in C:\Program Files)
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

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.

Related

Unable to install any package in computer at my office, how to fix?

I'm trying to use computer in my office for working using Rstudio because I realised that there is Rstudio installed in the computer. However, when I'm trying to install the package I need, the package is unable to install. I try so many package but the same issue happen.Even though, I'm trying to update installed package such as rlang version 1.02 to the latest one, it is also failed. I've tried to restart Rstudio as well after I installed the package, but I can't find the package that I have installed before.
Here is the error message that I receive when I try to install the very standard one such as scales package:
install.packages("scales")
also installing the dependencies ‘rlang’, ‘lifecycle’
There are binary versions available but the source versions are later:
binary source needs_compilation
rlang 1.0.2 1.0.6 TRUE
lifecycle 1.0.1 1.0.2 FALSE
scales 1.2.0 1.2.1 FALSE
Binaries will be installed
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/rlang_1.0.2.zip'
Content type 'application/zip' length 1718546 bytes (1.6 MB)
downloaded 1.6 MB
package ‘rlang’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\axk1076\AppData\Local\Temp\RtmpYjc7m3\downloaded_packages
installing the source packages ‘lifecycle’, ‘scales’
trying URL 'https://cran.rstudio.com/src/contrib/lifecycle_1.0.2.tar.gz'
Content type 'application/x-gzip' length 102178 bytes (99 KB)
downloaded 99 KB
trying URL 'https://cran.rstudio.com/src/contrib/scales_1.2.1.tar.gz'
Content type 'application/x-gzip' length 270609 bytes (264 KB)
downloaded 264 KB
'\\adf\storage\A\K\AXK1076'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported. Defaulting to Windows directory.
* installing *source* package 'lifecycle' ...
** package 'lifecycle' successfully unpacked and MD5 sums checked
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
namespace 'rlang' 1.0.2 is being loaded, but >= 1.0.5 is required
Calls: <Anonymous> ... withCallingHandlers -> loadNamespace -> namespaceImport -> loadNamespace
Execution halted
ERROR: lazy loading failed for package 'lifecycle'
* removing 'C:/Program Files/R/R-4.0.3/library/lifecycle'
Warning in install.packages :
installation of package ‘lifecycle’ had non-zero exit status
'\\adf\storage\A\K\AXK1076'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported. Defaulting to Windows directory.
ERROR: dependency 'lifecycle' is not available for package 'scales'
* removing 'C:/Program Files/R/R-4.0.3/library/scales'
Warning in install.packages :
installation of package ‘scales’ had non-zero exit status
The downloaded source packages are in
‘C:\Users\axk1076\AppData\Local\Temp\RtmpYjc7m3\downloaded_packages’
I don't know how Rstudio installed in this computer and I'm truly beginner in R. Is there anyone can help me? thank you in advance. Regards.
Since it is not known how R was installed in your computer, I would highly recommend you to uninstall both R and RStudio and installing the latest versions from the official websites.
First install R from: https://cran.r-project.org/bin/windows/base/
Install RStudio from: https://www.rstudio.com/products/rstudio/download/
Maybe they were installed in the wrong settings for your computer. Also to prevent bigger issues in the future (especially for beginners), that's the best option.

Failing to install LTM in R

I'm a complete beginner with R and any kind of programming really, and struggling with installing the LTM package for use in making a rasch analysis in SPSS 26.
I've used the command
install.packages("ltm")
tried in R3.3, 3.5 and 3.6 (all in MS windows) as these are compatible with the versions of SPSS I have access to, and get the following output returned:
*Installing package into ‘C:/Users/info/OneDrive/Documents/R/win-library/3.5’ (as ‘lib’ is unspecified) also installing the dependencies ‘admisc’, ‘polycor’ There are binary versions available but the source versions are later:
binary source needs_compilation admisc 0.8 0.28 FALSE polycor 0.7-10 0.8-1 FALSE ltm 1.1-1 1.2-0 FALSE installing the source packages ‘admisc’, ‘polycor’, ‘ltm’ trying URL 'https://cran.ma.imperial.ac.uk/src/contrib/admisc_0.28.tar.gz' Content type 'application/x-gzip' length 58877 bytes (57 KB) downloaded 57 KB trying URL 'https://cran.ma.imperial.ac.uk/src/contrib/polycor_0.8-1.tar.gz' Content type 'application/x-gzip' length 13931 bytes (13 KB) downloaded 13 KB trying URL 'https://cran.ma.imperial.ac.uk/src/contrib/ltm_1.2-0.tar.gz' Content type 'application/x-gzip' length 287001 bytes (280 KB) downloaded 280 KB
* installing *source* package 'admisc' ...
** package 'admisc' successfully unpacked and MD5 sums checked
** libs
*** arch - i386 Warning in system(cmd) : 'make' not found ERROR: compilation failed for package 'admisc'
* removing 'C:/Users/info/OneDrive/Documents/R/win-library/3.5/admisc'
* restoring previous 'C:/Users/info/OneDrive/Documents/R/win-library/3.5/admisc' In R CMD INSTALL
* installing *source* package 'polycor' ...
** package 'polycor' successfully unpacked and MD5 sums checked
** R
** inst
** byte-compile and prepare package for lazy loading Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : namespace 'admisc' 0.8 is being loaded, but >= 0.22 is required ERROR: lazy loading failed for package 'polycor'
* removing 'C:/Users/info/OneDrive/Documents/R/win-library/3.5/polycor' In R CMD INSTALL ERROR: dependency 'polycor' is not available for package 'ltm'
* removing 'C:/Users/info/OneDrive/Documents/R/win-library/3.5/ltm' In R CMD INSTALL The downloaded source packages are in
‘C:\Users\info\AppData\Local\Temp\Rtmpc5HpAg\downloaded_packages’ Warning messages: 1: In install.packages("ltm") : installation of package ‘admisc’ had non-zero exit status 2: In install.packages("ltm") : installation of package ‘polycor’ had non-zero exit status 3: In install.packages("ltm") : installation of package ‘ltm’ had non-zero exit status*
I've also attempted to install earlier versions of admisc and polycor but get an error message that they are not available with this version of R.
Hope somebody can spot what I'm doing wrong here!
Thanks in advance
The error message 'make' not found suggests that you need to install Rtools to be able to build packages in Windows.
Since you are using an old R version you also need older Rtools version like Rtools35, found here.
When installing Rtools remember to add rtools to Path using the checkbox in the dialog similar to that one.

How to compile an R package from source code in Windows 10

I need to compile an existing R package whose most recent version exists only as source code (it is on the CRAN website). I am running Windows 10. With Windows, install.packages just installs the older, binary version, which results in an error message and failure to install the package that depends on the one in question because the latter is not the recent version. I installed R Tools to my computer. The Installation and Administration manual for my version (3.6.3) refers to an Option “install.packages.compile.from.source.code”, but I don’t know to what command this option applies. If I run it in an Options() command it returns NULL. Moreover, the older, obsolete, binary version of the package was installed by install.packages. I don’t know if it is interfering with the process or how to get rid of it.
I can find guidance for ordinary install.packages and guidance for compilation oriented to package developers (which I’m not) in Stack Overflow, but nothing that applies to my situation (installing a package having an existing binary whose newest version exists only in source code, given that the binary version is already installed).
Any help you can offer would be greatly appreciated.
Thank you.
Sincerely,
Ward Kingkade
wwardkingkade#gmail.com
Illustration of basic issue (log):
> utils:::menuInstallPkgs()
--- Please select a CRAN mirror for use in this session ---
also installing the dependencies ‘ipred’, ‘recipes’
There are binary versions available but the source versions are later:
binary source needs_compilation
ipred 0.9-11 0.9-12 TRUE
recipes 0.1.16 0.1.17 FALSE
caret 6.0-86 6.0-90 TRUE
Binaries will be installed
trying URL 'https://mirrors.nics.utk.edu/cran/bin/windows/contrib/3.6/ipred_0.9-11.zip'
Content type 'application/zip' length 401183 bytes (391 KB)
downloaded 391 KB
trying URL 'https://mirrors.nics.utk.edu/cran/bin/windows/contrib/3.6/caret_6.0-86.zip'
Content type 'application/zip' length 6258933 bytes (6.0 MB)
downloaded 6.0 MB
package ‘ipred’ successfully unpacked and MD5 sums checked
package ‘caret’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\Ward_\AppData\Local\Temp\RtmpghJ2SG\downloaded_packages
installing the source package ‘recipes’
trying URL 'https://mirrors.nics.utk.edu/cran/src/contrib/recipes_0.1.17.tar.gz'
Content type 'application/x-gzip' length 681531 bytes (665 KB)
downloaded 665 KB
* installing *source* package 'recipes' ...
** package 'recipes' successfully unpacked and MD5 sums checked
** using staged installation
** R
** inst
** byte-compile and prepare package for lazy loading
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
namespace 'ipred' 0.9-11 is being loaded, but >= 0.9.12 is required
Calls: <Anonymous> ... namespaceImportFrom -> asNamespace -> loadNamespace
Execution halted
ERROR: lazy loading failed for package 'recipes'
* removing 'C:/Users/Ward_/Documents/R/win-library/3.6/recipes'
The downloaded source packages are in
‘C:\Users\Ward_\AppData\Local\Temp\RtmpghJ2SG\downloaded_packages’
Warning message:
In install.packages(lib = .libPaths()[1L], dependencies = NA, type = type) :
installation of package ‘recipes’ had non-zero exit status

Different version of GlobalOptions package in R

I'm trying to install the package "circlize" and I am having trouble resolving what seems to be a simple error.
When I run:
install.packages("circlize")
It says:
Installing package into ‘*file location*/3.2’
(as ‘lib’ is unspecified)
Warning in install.packages :
dependency ‘GlobalOptions’ is not available
There is a binary version available but the source version is later:
binary source needs_compilation
circlize 0.3.10 0.4.3 FALSE
installing the source package ‘circlize’
trying URL 'https://mirrors.sorengard.com/cran/src/contrib/circlize_0.4.3.tar.gz'
Content type 'application/x-gzip' length 2456906 bytes (2.3 MB)
downloaded 2.3 MB
* installing *source* package 'circlize' ...
** package 'circlize' successfully unpacked and MD5 sums checked
** R
** demo
** inst
** preparing package for lazy loading
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
namespace 'GlobalOptions' 0.0.11 is being loaded, but >= 0.0.12 is required
ERROR: lazy loading failed for package 'circlize'
* removing '*file location*/3.2/circlize'
Warning in install.packages :
running command '"*file location*/x64/R" CMD INSTALL -l "*file location*\3.2" *file location*/downloaded_packages/circlize_0.4.3.tar.gz' had status 1
Warning in install.packages :
installation of package ‘circlize’ had non-zero exit status
The downloaded source packages are in
‘*file location*\downloaded_packages’
These parts seem most relevant to me:
dependency ‘GlobalOptions’ is not available
namespace 'GlobalOptions' 0.0.11 is being loaded, but >= 0.0.12 is required
When I run sessionInfo() I see under "other attached packages": [1] GlobalOptions_0.0.11
My best guess is that I have the wrong version of GlobalOptions -- I see that GlobalOptions v0.0.13 is available here, but being new to R, I'm not sure what to do now to get the right version up and running.
I'd really appreciate if someone could tell me where I should look next. (I looked through the documentation within that link, but I'm still lost about what to do now.) Thanks!
If you have R version >=3.3.0 you should
install GlobalOptions_0.0.13 from CRAN
install.packages("GlobalOptions")
quit and restart R
re-install circlize from source as before.
If you have an older R version, update R to a more recent version first.

unable to install packages("caret") completely in R version 3.2.3

> require("caret")
Loading required package: caret
Loading required package: lattice
Loading required package: ggplot2
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
there is no package called ‘pbkrtest’
So I found that there is lack of "pbkrtest" then I tried to reinstall it.
> install.packages("pbkrtest")
Installing package into ‘C:/Users/ADMIN/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
There is a binary version available but the source version is
later:
binary source needs_compilation
pbkrtest 0.4-2 0.4-3 FALSE
installing the source package ‘pbkrtest’
trying URL 'https://rweb.crmda.ku.edu/cran/src/contrib/pbkrtest_0.4- 3.tar.gz'
Content type 'application/x-gzip' length 164415 bytes (160 KB)
downloaded 160 KB
* installing *source* package 'pbkrtest' ...
** package 'pbkrtest' successfully unpacked and MD5 sums checked
** R
** data
** inst
** preparing package for lazy loading
Warning: replacing previous import by 'stats::sigma' when loading 'pbkrtest'
Error : object 'sigma' is not exported by 'namespace:stats'
ERROR: lazy loading failed for package 'pbkrtest'
* removing 'C:/Users/ADMIN/Documents/R/win-library/3.2/pbkrtest'
The downloaded source packages are in
‘C:\Users\ADMIN\AppData\Local\Temp\Rtmpk7mJT0\downloaded_packages’
Warning messages:
1: running command '"D:/R-3.2.3/bin/x64/R" CMD INSTALL -l
"C:\Users\ADMIN\Documents\R\win-library\3.2"
C:\Users\ADMIN\AppData\Local\Temp\Rtmpk7mJT0/downloaded_packages/pbkrtest_0.4- 3.tar.gz' had status 1
2: In install.packages("pbkrtest") :
installation of package ‘pbkrtest’ had non-zero exit status
It seems like that the installation keeps failing.
As a result, I couldn't use other code using caret packages.
I faced this problem as well on Windows 7. I did following steps in the sequence and it worked.
a) Make sure your R version is updated latest R release 3.2.3
b) The default sources seems to be installing Unix version. So I manually downloaded https://cran.r-project.org/web/packages/pbkrtest/index.html for windows
c) Use manually install function from R menu to install the package.
Cheers,
Ratan
Check version of R by typing version in your console.
If version is not "version.string R version 3.3.2" or later then
Install new version of R from https://cran.r-project.org/bin/windows/base/
Update R version using Tools => Global Options in RStudio.
install package using "install.packages("caret")" in your console.
do require(caret).
test using ?createDataPartition.

Resources