Fixing rlang access denied - r

Can't seem to find a viable solution getting rlang to install after updating rstudio.
I tried using --no lock on builder tools https://work.sparktseung.com/pages/2021-09-06-R-build-package-permission/
Also tried uninstalling it and reinstalling w/ remove.packages this hasn't worked for me either after restarting.
> library(rlang)
Error in library(rlang) : there is no package called ‘rlang’
> remove.packages("rlang")
Removing package from ‘C:/Users/user/AppData/Local/R/win-library/4.2’
(as ‘lib’ is unspecified)
Error in remove.packages : there is no package called ‘rlang’
Restarting R session...
> library(rlang)
Error in library(rlang) : there is no package called ‘rlang’
Here's the error when trying to install via url
Warning in file.rename(instdir, final_instdir) :
cannot rename file 'C:/Users/user/AppData/Local/R/win-library/4.2/00LOCK-rlang/00new/rlang' to 'C:/Users/user/AppData/Local/R/win-library/4.2/rlang', reason 'Access is denied'
ERROR: moving to final location failed
* removing 'C:/Users/user/AppData/Local/R/win-library/4.2/rlang'
Warning in install.packages :
installation of package ‘C:/Users/user/AppData/Local/Temp/Rtmp8sB5rS/downloaded_packages/rlang_1.0.5.tar.gz’ had non-zero exit status
Install Line
install.packages("https://cran.r-project.org/src/contrib/Archive/rlang/rlang_1.0.5.tar.gz", repo=NULL, type="source")
Session Info
R version 4.2.0 (2022-04-22 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19044)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.utf8 LC_CTYPE=English_United States.utf8
[3] LC_MONETARY=English_United States.utf8 LC_NUMERIC=C
[5] LC_TIME=English_United States.utf8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.2.0 tools_4.2.0
Really need to run some scripts, any help would be appreciated.

Related

Package 'xxx’ was installed before R 4.0.0: please re-install it (already done fresh install and checked lib paths)

I am having some issue with installing a package in R 4.0.2 from binaries. Here is my attempt:
> install.packages("C:/Users/MNestor/Downloads/libSBML_5.18.0.zip", repos = NULL, type = "win.binary")
Installing package into ‘C:/Users/MNestor/Documents/R/win-library/4.0’ (as ‘lib’ is unspecified)
package ‘libSBML’ successfully unpacked and MD5 sums checked
Warning messages:
1: multiple methods tables found for ‘type’
2: multiple methods tables found for ‘type<-’
Next I load library:
> library('libSBML')
Error: package or namespace load failed for ‘libSBML’:
package ‘libSBML’ was installed before R 4.0.0: please re-install it
This error is confusing to me because I am working in R 4.0.2 and have clearly just done a fresh install.
I have tried
deleting the library folder and reinstalling
running remove.packages('libSBML') and reinstalling
For reference here are my library directories:
> .libPaths()
[1] "C:/Users/MNestor/Documents/R/win-library/4.0"
[2] "C:/Program Files/R/R-4.0.2/library"
The libSMBL folder is located in the first library path, and not the second (as expected).
Here is session info:
> sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 17134)
Matrix products: default
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] parallel stats graphics grDevices utils datasets methods base
other attached packages:
[1] rsbml_2.46.0 BiocGenerics_0.34.0
loaded via a namespace (and not attached):
[1] BiocManager_1.30.10 compiler_4.0.2 tools_4.0.2 remotes_2.2.0
[5] stats4_4.0.2 SBMLR_1.84.0 graph_1.66.0
The error message is maybe a bit confusing, but it's saying the package is already compiled for an earlier version of R. (That's what the option "win.binary" means).
R 4.0 and earlier binaries are not compatible because of updated compilers and build tools.
You'll need to install the package from source, which likely means installing R tools (https://cran.r-project.org/bin/windows/Rtools/) or you'll need to use a version that is pre-built for R 4.0 or later.

Getting an error in R - [Error: could not find function "qplot"]

Orginal R version
R version 3.2.2 (2015-08-14) -- "Fire Safety"
Copyright (C) 2015 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)
> library(ggplot2)
Error in library.dynam(lib, package, package.lib) :
DLL ‘colorspace’ not found: maybe not installed for this architecture?
In addition: Warning message:
package ‘ggplot2’ was built under R version 3.2.3
Error: package or namespace load failed for ‘ggplot2’
> qplot(weights, prices, color = types)
Error: could not find function "qplot"
.... Hi got some issues running ggplot2, I'm trying to get through a basic online tutorial then the issue, was trying to run the qplot in one of the exercises then i got the errors as listed above, I've read around a bit on previous help lookups, went through the motions of:
install.packages("proto")
install.packages('ggplot2', dep = TRUE),
rebooting R - still getting the error. Any other "answer"?
#MLavoie, Mike Wise
> install.packages('ggplot2', dependencies = TRUE)
Installing package into ‘C:/Users/Sony/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.2/ggplot2_2.0.0.zip'
Content type 'application/zip' length 1977368 bytes (1.9 MB)
downloaded 1.9 MB
package ‘ggplot2’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\Sony\AppData\Local\Temp\RtmpY97TTR\downloaded_packages
> library("ggplot2", lib.loc="~/R/win-library/3.2")
Error in get(Info[i, 1], envir = env) :
cannot open file 'C:/Users/Sony/Documents/R/win-library/3.2/scales/R/scales.rdb': No such file or directory
Error: package or namespace load failed for ‘ggplot2’
Session Info:
> sessionInfo()
R version 3.2.3 (2015-12-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] ggplot2movies_0.0.1
loaded via a namespace (and not attached):
[1] colorspace_1.2-6 plyr_1.8.3 tools_3.2.3 gtable_0.1.2 Rcpp_0.12.3 grid_3.2.3 munsell_0.4.2
I had the same error after installing ggplot2. Two ways around this:
1) You need to load "library(ggplot2)" before you call qplot()
library(ggplot2)
qplot(factor(CLASS), VOLUME, data = abalone, geom = "boxplot")
2) I discovered randomly that adding "ggplot2::" in front of your code also makes it work, without calling the library.
ggplot2::qplot(factor(CLASS), VOLUME, data = abalone, geom = "boxplot")

Issue installing package 'quantmod'

I keep having this error when I try to install quantmod package from the CRAN repository:
install.packages("quantmod")
Installing package into ‘C:/Users/Dominic/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
also installing the dependencies ‘xts’, ‘zoo’, ‘TTR’
Packages which are only available in source form, and may need compilation of
C/C++/Fortran: ‘xts’ ‘zoo’ ‘TTR’ ‘quantmod’
These will not be installed
I also downloaded the .gz files locally and install but get the following error:
Installing package into ‘C:/Users/Dominic/Documents/R/win-library/3.2’
(as ‘lib’ is unspecified)
ERROR: dependencies 'xts', 'zoo', 'TTR' are not available for package 'quantmod'
* removing 'C:/Users/Dominic/Documents/R/win-library/3.2/quantmod'
Warning in install.packages :
running command '"C:/PROGRA~1/R/R-32~1.2/bin/x64/R" CMD INSTALL -l "C:\Users\Dominic\Documents\R\win-library\3.2" "C:/Users/Dominic/AppData/Local/Temp/RtmpMnw2yn/downloaded_packages/quantmod_0.4-5.tar.gz"' had status 1
Warning in install.packages :
installation of package ‘C:/Users/Dominic/AppData/Local/Temp/RtmpMnw2yn/downloaded_packages/quantmod_0.4-5.tar.gz’ had non-zero exit status
Here is the output of sessionInfo()
R version 3.2.2 (2015-08-14)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 8 x64 (build 9200)
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] tools_3.2.2
1- Download the latest version from:
https://cran.r-project.org/bin/windows/contrib/3.4/quantmod_0.4-8.zip
2- unzip it in your package directory. It can be found with:
.libPaths()
3- Make sure the folder name reads "quantmod" in your package directory.
4- Type in library("quantmod")

Error with installing an old package

A co-worked built a model using both an older version of R (3.1.3) and an older version of randomForestSRC (1.6.0). I have R version 3.2.1 and randomForestSRC version 1.6.1. I was able to install an older version of the randomForestSRC package using the function InstallOldPackage from the repmis package using R 3.2.1. However, it turns out I need to use the old version (3.1.3) to be able to work on this project. Unfortunately, after switching to 3.1.3 I am having trouble actually installing the older version of the randomForestSRC package.
Here is the system info:
> sessionInfo()
R version 3.1.3 (2015-03-09)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows Server 2012 x64 (build 9200)
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] parallel stats graphics grDevices utils datasets methods base
other attached packages:
[1] repmis_0.4.4 randomForestSRC_1.6.1
loaded via a namespace (and not attached):
[1] chron_2.3-47 data.table_1.9.6 digest_0.6.8 httr_1.0.0 magrittr_1.5
[6] plyr_1.8.3 R.cache_0.10.0 R.methodsS3_1.7.0 R.oo_1.19.0 R.utils_2.1.0
[11] R6_2.1.1 Rcpp_0.12.1 stringi_1.0-1 stringr_1.0.0 tools_3.1.3
This is where I run into the error (I apologize for the large block of text):
> library(repmis)
> InstallOldPackages(pkgs = "randomForestSRC",versions = "1.6.0")
trying URL 'http://cran.r- project.org/src/contrib/Archive/randomForestSRC/randomForestSRC_1.6.0.tar.gz'
Content type 'application/x-gzip' length 943881 bytes (921 KB)
opened URL
downloaded 921 KB
* installing *source* package 'randomForestSRC' ...
** package 'randomForestSRC' successfully unpacked and MD5 sums checked
** libs
*** arch - i386
Warning: running command 'make -f "C:/Users/baasman/DOCUME~1/R/R- 31~1.3/etc/i386/Makeconf" -f "C:/Users/baasman/DOCUME~1/R/R- 31~1.3/share/make/winshlib.mk" SHLIB="randomForestSRC.dll" OBJECTS="bootstrap.o classification.o dataParser.o entry.o factorOps.o importance.o impute.o nodeOps.o nrutil.o random.o regression.o rfsrc.o rfsrcUtil.o split.o splitClas.o splitCustom.o splitRegr.o splitSurv.o splitUspv.o splitUtil.o stack.o stackOutput.o stackPreDefined.o survival.o survivalE.o termOps.o trace.o tree.o treeUtil.o"' had status 127
ERROR: compilation failed for package 'randomForestSRC'
* removing 'C:/Users/baasman/Documents/R/R-3.1.3/library/randomForestSRC'
* restoring previous 'C:/Users/baasman/Documents/R/R- 3.1.3/library/randomForestSRC'
Warning in file.copy(lp, dirname(pkgdir), recursive = TRUE, copy.date = TRUE) :
problem copying C:\Users\baasman\Documents\R\R-3.1.3\library\00LOCK- randomForestSRC\randomForestSRC\libs\x64\randomForestSRC.dll to C:\Users\baasman\Documents\R\R- 3.1.3\library\randomForestSRC\libs\x64\randomForestSRC.dll: Permission denied
Warning in install.packages :
running command '"C:/Users/baasman/DOCUME~1/R/R-31~1.3/bin/x64/R" CMD INSTALL -l "C:\Users\baasman\Documents\R\R-3.1.3\library" "randomForestSRC_1.6.0.tar.gz"' had status 1
Warning in install.packages :
installation of package ‘randomForestSRC_1.6.0.tar.gz’ had non-zero exit status
pkgs V1
1 randomForestSRC 0

Gain Package Installation error in R 3.1.2

I am trying to install the Gains package in R Studio Version 3.1.2 like this:
install.packages("gains")
The following warnings appear:
InternetOpenUrl failed: 'The server name or address could not be resolved'
Warning in install.packages :unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/3.1
Warning in install.packages :package ‘gains’ is not available (for R version 3.1.2)
Does anyone know how can I fix this?
Thanks!
I believe that the problem lies in your corrupted, incomplete or otherwise incorrect R environment. I was able to install that package without any problems at all just by issuing the default command:
> install.packages("gains")
Installing package into ‘C:/Users/Alex/Documents/R/win-library/3.1’
(as ‘lib’ is unspecified)
trying URL 'http://cran.rstudio.com/bin/windows/contrib/3.1/gains_1.1.zip'
Content type 'application/zip' length 35802 bytes (34 Kb)
opened URL
downloaded 34 Kb
package ‘gains’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\Alex\AppData\Local\Temp\RtmpSSRths\downloaded_packages
> sessionInfo()
R version 3.1.1 (2014-07-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods
[7] base
loaded via a namespace (and not attached):
[1] tools_3.1.1
As a quick solution to the problem, I suggest to specify CRAN mirror explicitly:
install.packages("gains", repos = "http://cran.rstudio.com")

Resources