Library installation issues- rlang - r

I have a new laptop that was working with R and R studio and then after updating packages I have run into continual issues loading or installing R packages in R studio.
I have tried to uninstall R and R studio deleted all folders associated and then re-installed.
removing and re-installing rlang however it keeps coming up as not properly installed.
Checked my .libPath ()
My question is how do you make sure you have closed everything so you do not have any .dll file open and then therefore so that the installer can overwrite .dll? will this solve my issue?
Restarting R session...
> .libPaths()
[1] "C:/R-4.0.4/library"
> install.packages("rlang")
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/rlang_0.4.10.zip'
Content type 'application/zip' length 1181510 bytes (1.1 MB)
downloaded 1.1 MB
package ‘rlang’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\dhiam\AppData\Local\Temp\RtmpuiHNNP\downloaded_packages
> tools::checkMD5sums("rlang")
[1] TRUE
> library(rlang)
Error: package or namespace load failed for ‘rlang’:
.onLoad failed in loadNamespace() for 'rlang', details:
call: NULL
error: The rlang package is not properly installed.
The DLL version does not correspond to the package version.
Please update rlang to the latest version.
Updating packages on Windows requires precautions:
<https://github.com/jennybc/what-they-forgot/issues/62>
> sessionInfo()
R version 4.0.4 (2021-02-15)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)
Matrix products: default
locale:
[1] LC_COLLATE=English_xx.1252 LC_CTYPE=English_xx.1252 LC_MONETARY=English_xx.1252
[4] LC_NUMERIC=C LC_TIME=English_xx.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.0.4 tools_4.0.4 gtable_0.3.0 grid_4.0.4
Please also note, I do not have admin rights to this computer (as it is work laptop).

Related

Permission denied on .dll file when installing package

New job gave me a fresh Windows laptop where I am struggling (to say the very least) to set up a fresh R environment. Specifically, when developing a package, the commmand Install and Restart exits abruptly due to permission issues on a specific .dll file.
==> Rcmd.exe INSTALL --no-multiarch --with-keep.source --install-tests curl
* installing to library 'C:/R/R-Library'
* installing *source* package 'curl' ...
ERROR: cannot remove earlier installation, is it in use?
* removing 'C:/R/R-Library/curl'
* restoring previous 'C:/R/R-Library/curl'
Warning in file.copy(lp, dirname(pkgdir), recursive = TRUE, copy.date = TRUE) :
problem copying C:\R\R-Library\00LOCK-curl\curl\libs\x64\curl.dll to C:\R\R-Library\curl\libs\x64\curl.dll: Permission denied
Exited with status 1.
As a first attempt to ameliorate the issue, I've moved both my R installation and library at C:/. This obviously seems not to be enough.
> .libPaths()
[1] "C:/R/R-Library" "C:/R/R-4.0.3/library"
> sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19042)
Matrix products: default
locale:
[1] LC_COLLATE=Italian_Italy.1252 LC_CTYPE=Italian_Italy.1252 LC_MONETARY=Italian_Italy.1252 LC_NUMERIC=C
[5] LC_TIME=Italian_Italy.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.0.3 tools_4.0.3
I am kind of lost as to where to look next. As a last shot in the dark I've tried to run RStudio with Admin right with no luck.

How to deal with: Error: could not find function "read_csv"

I installed the package readr and tried to upload a .csv file in Rstudio.
When I try to load this package I get the following error:
> library(readr)
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()),
versionCheck = vI[[j]]) : there is no package called ‘hms’ In addition:
Warning message: Paket ‘readr’ wurde unter R Version 3.2.5 erstellt
Error: Laden von Paket oder Namensraum für ‘readr’ fehlgeschlagen
When I try to upload the .csv file in R I get the error:
> dataX<-read_csv("file.csv")
Error: could not find function "read_csv"
The result of sessionInfo() is:
> sessionInfo()
R version 3.2.2 (2015-08-14)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=German_Germany.1252 LC_CTYPE=German_Germany.1252
[3] LC_MONETARY=German_Germany.1252 LC_NUMERIC=C
[5] LC_TIME=German_Germany.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] colorspace_1.3-2 scales_0.4.1 R6_2.2.2 lazyeval_0.2.0 plyr_1.8.4
[6] tools_3.2.2 gtable_0.2.0 tibble_1.3.0 Rcpp_0.12.10 ggplot2_2.2.1
[11] grid_3.2.2 munsell_0.4.3
I will appreciate your help. Thanks.
Ok, I was able to duplicate the problem on Windows. How and Why?
Resolution - Install R3.4.4
How
Install R3.4.4
Install Rtools3.4.
Launch R
> install.packages("readr")
Why?
The issue here (appears to be) that readr and the TidyVerse packages require later versions of R than R3.2.2. and the WIndows Rtools you have. I was able to duplicate the issue described by installing R3.2.2 and RTools3.2 and then trying to instal readr.
I did not encounter the error on installation of R3.4.4.
Background on Upgrading R on Windows:
You can install multiple versions of R (Base environment) and R Tools (Development environment) on Windows. My personal recommendation is to uninstall R, install the new versions of R, then install the latest R Tools and copy over the libraries per Windows faq below.
R Windows FAQ
2.8 What’s the best way to upgrade?
That’s a matter of taste. For most people the best thing to do is to uninstall R (see the previous Q), install the new version, copy any installed packages to the library folder in the new installation, run update.packages(checkBuilt=TRUE, ask=FALSE) in the new R and then delete anything left of the old installation. Different versions of R are quite deliberately installed in parallel folders so you can keep old versions around if you wish.
For those with a personal library (folder R\win-library\x.y of your home directory, R\win64-library\x.y on 64-bit builds), you will need to update that too when the minor version of R changes (e.g. from 3.0.2 to 3.1.0). A simple way to do so is to copy (say) R\win-library\3.0 to R\win-library\3.1 before running update.packages(checkBuilt=TRUE, ask=FALSE).
I too had the similar problem and re-installing package "tidyverse" did the trick for me while I was already on 3.4.4 version of R.
For me, it was loading tidyverse into the environment that did the trick. Load both tidyverse and dplyr

Error installing packages in RStudio: error reading from connection

I have recently updated both R (version 3.4.1) and RStudio (version 1.0.143) and I am now unable to install packages from Rstudio.
If I install a package in R directly using install.packages() it works fine.
If I try and install a package in Rstudio using either install.packages() or using the package install menu I get the error below. I have tried a few different packages, and have uninstalled and reinstalled both R and RStudio.
To get the error:
Run:
install.packages("lme4")
Output:
Installing package into ‘E:/Documents/R/win-library/3.4’
(as ‘lib’ is unspecified)
also installing the dependencies ‘minqa’, ‘nloptr’, ‘RcppEigen’
Warning in install.packages :
lzma decoding result 10
Error in install.packages : error reading from connection
I am working off my personal computer, below is some of my system info:
Output from options("repos")
$repos
CRAN CRANextra
"https://cran.stat.auckland.ac.nz/" "http://www.stats.ox.ac.uk/pub/RWin"
attr(,"RStudio")
[1] TRUE
Output from sessionInfo()
R version 3.4.1 (2017-06-30)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
Matrix products: default
locale:
[1] LC_COLLATE=English_New Zealand.1252 LC_CTYPE=English_New Zealand.1252
LC_MONETARY=English_New Zealand.1252
[4] LC_NUMERIC=C LC_TIME=English_New Zealand.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_3.4.1 tools_3.4.1
This certainly is an issue with your connection:the proxies you are using and repositories configured in your RStudio. I was getting the same error when I was connected to US VPN from India.I disconnected VPN and restarted RStudio and it worked like a charm!
I had the same issue when I tried to install caret.
The best solution is to restart R studio.
Now the install.packages() works fine.
Just restart the R studio it works for me.
I had the same issue after I misspelled a package name when trying to install it. I restarted R Studio and then it worked.
Kindly select appropriate CRAN mirror in R Studio through following option:
Tools>>>Packages>>>CRAN Mirror(Select appropriate CRAN depending on your location).
A simple solution would be to download manually the zip folder of the package and install it with the command :
install.packages('package.zip', lib='destination_directory',repos = NULL)
Package zip : the path to the zip file of the package
Destination_directory: where the packages are installed by default like C:/Users/unknown/Documents/R/win-library/3.3
Hope it helps

R: Packrat init() returns error "cannot set reparse point" and "target already exists and is not a symlink"

I wanted to try packrat, but I ran into a warning and error message upon initializing it on a project:
> library(packrat)
> packrat::init()
Initializing packrat project in directory:
- "\\userhome/myuser/R_scripts/ratpack_test"
Adding these packages to packrat:
_
packrat 0.4.8-1
Fetching sources for packrat (0.4.8-1) ... OK (CRAN current)
Snapshot written to "\\userhome/myuser/R_scripts/ratpack_test/packrat/packrat.lock"
Installing packrat (0.4.8-1) ...
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.2/packrat_0.4.8-1.zip'
Content type 'application/zip' length 192726 bytes (188 KB)
downloaded 188 KB
OK (downloaded binary)
Initialization complete!
Warning message:
In Sys.junction(from, to) :
cannot set reparse point '\\userhome/myuser/R_scripts/ratpack_test/packrat/lib-R/base', reason 'Incorrect function'
Restarting R session...
Error in ensurePackageSymlink(source, target) :
Target '\\userhome/myuser/R_scripts/ratpack_test/packrat/lib-R/base' already exists and is not a symlink
It says cannot set reparse point 'my_custom_path', reason 'Incorrect function', and Target already exists and is not a symlink. Has anybody experienced a similar behavior? I'm running R 3.2.0 and Windows10.
> sessionInfo()
R version 3.2.0 (2015-04-16)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 8 x64 (build 9200)
locale:
[1] LC_COLLATE=German_Switzerland.1252 LC_CTYPE=German_Switzerland.1252 LC_MONETARY=German_Switzerland.1252 LC_NUMERIC=C
[5] LC_TIME=German_Switzerland.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] packrat_0.4.8-1
loaded via a namespace (and not attached):
[1] tools_3.2.0

I can't load devtools in R 3.2.0

I am developping R packages with Rstudio. Until now, I used R 3.1.2 and all worked fine. Recently I have updated R to 3.2.0 version and I have updated the packages too. Now, when loading devtools:
> library(devtools)
Error in inDL(x, as.logical(local), as.logical(now), ...) :
unable to load shared object 'C:/Documents and Settings/cruiz.CREAL/Mis documentos/R/win-library/3.2/git2r/libs/i386/git2r.dll':
LoadLibrary failure: No se encontró el proceso especificado.
Error: package or namespace load failed for ‘devtools’
I have reinstalled devtools and git2r with biocLite and with install.packages and it didn't work. This file already exists and it is on this path.
My R session Info:
R version 3.2.0 (2015-04-16)
Platform: i386-w64-mingw32/i386 (32-bit)
Running under: Windows XP (build 2600) Service Pack 3
locale:
[1] LC_COLLATE=Spanish_Spain.1252 LC_CTYPE=Spanish_Spain.1252
[3] LC_MONETARY=Spanish_Spain.1252 LC_NUMERIC=C
[5] LC_TIME=Spanish_Spain.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] tools_3.2.0
Thank you very much!
I suggest the following:
remove.packages(c("git2r", "devtools", "rversions")).
Use the information from my answer on this post -- R - Error installing Devtools in Windows to reinstall devtools. This should also reinstall the needed dependencies.

Resources