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

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.

Related

Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding

I need to install the “lifecycle” package in order to run an R code but I’m getting the error below.
I’ve already uninstalled and re-installed both RTools and R for Windows with no luck.
The WARNING message states to install the appropriate version of Rtools before proceeding – how do I find out what the ‘appropriate’ version that I would need to install?
>install.packages("lifecycle")
WARNING: Rtools is required to build R packages but is not currently installed. Please download and install the appropriate version of Rtools before proceeding:
https://cran.rstudio.com/bin/windows/Rtools/
Installing package into ‘c:/RLibrary’
(as ‘lib’ is unspecified)
also installing the dependency ‘cli’
There are binary versions available but the source versions
are later:
binary source needs_compilation
cli 2.5.0 3.4.1 TRUE
lifecycle 1.0.0 1.0.3 FALSE
Binaries will be installed
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.6/cli_2.5.0.zip'
Content type 'application/zip' length 534931 bytes (522 KB)
downloaded 522 KB
package ‘cli’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\X\AppData\Local\Temp\RtmpM95qM9\downloaded_packages
installing the source package ‘lifecycle’
trying URL 'https://cran.rstudio.com/src/contrib/lifecycle_1.0.3.tar.gz'
Content type 'application/x-gzip' length 106854 bytes (104 KB)
downloaded 104 KB
* 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 inDL(x, as.logical(local), as.logical(now), ...) :
unable to load shared object 'c:/RLibrary/rlang/libs/x64/rlang.dll':
LoadLibrary failure: The specified procedure could not be found.
Calls: <Anonymous> ... namespaceImport -> loadNamespace -> library.dynam -> dyn.load -> inDL
Execution halted
ERROR: lazy loading failed for package 'lifecycle'
* removing 'c:/RLibrary/lifecycle'
Warning in install.packages :
installation of package ‘lifecycle’ had non-zero exit status

I am unable to install ggplot, there occurs some error

there is this long error message when i try to install ggplot, please someone help me. Thanks!
install.packages("ggplot2")
Installing package into ‘C:/Users/HP/Documents/R/win-library/3.4’
(as ‘lib’ is unspecified)
also installing the dependency ‘rlang’
There are binary versions available but the source versions are later:
binary source needs_compilation
rlang 0.3.4 1.0.1 TRUE
ggplot2 3.1.1 3.3.5 FALSE
Binaries will be installed
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/rlang_0.3.4.zip'
Content type 'application/zip' length 1080437 bytes (1.0 MB)
downloaded 1.0 MB
package ‘rlang’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\HP\AppData\Local\Temp\Rtmpwfvrv8\downloaded_packages
installing the source package ‘ggplot2’
trying URL 'https://cran.rstudio.com/src/contrib/ggplot2_3.3.5.tar.gz'
Content type 'application/x-gzip' length 3063309 bytes (2.9 MB)
downloaded 2.9 MB
installing source package 'ggplot2' ...
** package 'ggplot2' successfully unpacked and MD5 sums checked
** R
** data
*** moving datasets to lazyload DB
** inst
** preparing package for lazy loading
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
namespace 'rlang' 0.3.4 is being loaded, but >= 0.4.10 is required
ERROR: lazy loading failed for package 'ggplot2'
removing 'C:/Users/HP/Documents/R/win-library/3.4/ggplot2'
Warning in install.packages :
running command '"C:/PROGRA~1/R/R-34~1.1/bin/i386/R" CMD INSTALL -l "C:\Users\HP\Documents\R\win-library\3.4" C:\Users\HP\AppData\Local\Temp\Rtmpwfvrv8/downloaded_packages/ggplot2_3.3.5.tar.gz' had status 1
Warning in install.packages :
installation of package ‘ggplot2’ had non-zero exit status
The downloaded source packages are in
‘C:\Users\HP\AppData\Local\Temp\Rtmpwfvrv8\downloaded_packages’
It's saying your "rlang" version is outdated. Update that, it should be fine. Update all the libraries, that's a good practice while installing packages. (you do the same from tool option in menubar of Rstudio and update package)

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

I can't seem to install the 'ecospat' package on R studio for windows

I am unable to install the 'ecospat' package on R and I was wondering why this could be?
After running the following bit of code using R in windows.....
install.packages('ecospat')
This is the error message I get...
Installing package into ‘C:/Users/etelford.IC.000/Documents/R/win-library/3.4’
(as ‘lib’ is unspecified)
also installing the dependencies ‘pROC’, ‘biomod2’
There are binary versions available but the source versions are later:
binary source needs_compilation
pROC 1.14.0 1.16.2 TRUE
biomod2 3.3-7.1 3.4.6 FALSE
ecospat 3.0 3.1 FALSE
Binaries will be installed
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/pROC_1.14.0.zip'
Content type 'application/zip' length 941305 bytes (919 KB)
downloaded 919 KB
package ‘pROC’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\etelford.IC.000\AppData\Local\Temp\RtmpsBJC01\downloaded_packages
installing the source packages ‘biomod2’, ‘ecospat’
trying URL 'https://cran.rstudio.com/src/contrib/biomod2_3.4.6.tar.gz'
Content type 'application/x-gzip' length 665227 bytes (649 KB)
downloaded 649 KB
trying URL 'https://cran.rstudio.com/src/contrib/ecospat_3.1.tar.gz'
Content type 'application/x-gzip' length 2179055 bytes (2.1 MB)
downloaded 2.1 MB
installing source package 'biomod2' ...
** package 'biomod2' successfully unpacked and MD5 sums checked
** R
** inst
** preparing package for lazy loading
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
namespace 'pROC' 1.14.0 is being loaded, but >= 1.15.0 is required
ERROR: lazy loading failed for package 'biomod2'
removing 'C:/Users/etelford.IC.000/Documents/R/win-library/3.4/biomod2'
In R CMD INSTALL
Warning in install.packages :
running command '"C:/PROGRA~1/R/R-34~1.4/bin/x64/R" CMD INSTALL -l "C:\Users\etelford.IC.000\Documents\R\win-library\3.4" C:\Users\ETELFO~1.000\AppData\Local\Temp\RtmpsBJC01/downloaded_packages/biomod2_3.4.6.tar.gz' had status 1
Warning in install.packages :
installation of package ‘biomod2’ had non-zero exit status
ERROR: dependency 'biomod2' is not available for package 'ecospat'
removing 'C:/Users/etelford.IC.000/Documents/R/win-library/3.4/ecospat'
In R CMD INSTALL
Warning in install.packages :
running command '"C:/PROGRA~1/R/R-34~1.4/bin/x64/R" CMD INSTALL -l "C:\Users\etelford.IC.000\Documents\R\win-library\3.4" C:\Users\ETELFO~1.000\AppData\Local\Temp\RtmpsBJC01/downloaded_packages/ecospat_3.1.tar.gz' had status 1
Warning in install.packages :
installation of package ‘ecospat’ had non-zero exit status
Any help would be greatly appreciated,
thanks
First of all you need to update your R version. I think you use an R 3.4 version.
The main reason why your installation fails is that you need to install pROC > 1.15 and this is not available for R 3.4.

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

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.

Resources