Reputation: 1597
When I try to run a particular function: I get the following error:
> wrangled_devices <- wrangle_devices(params$filtered_devices)
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
namespace ‘rlang’ 0.4.12 is already loaded, but >= 1.0.1 is required
So I figure I'll update the package as instructed. But that doesn't work:
install.packages("rlang")
Installing package into ‘C:/Users/thebi/Documents/R/win-library/4.1’
(as ‘lib’ is unspecified)
trying URL 'https://cran.rstudio.com/bin/windows/contrib/4.1/rlang_1.0.2.zip'
Content type 'application/zip' length 1721024 bytes (1.6 MB)
downloaded 1.6 MB
package ‘rlang’ successfully unpacked and MD5 sums checked
Warning in install.packages :
cannot remove prior installation of package ‘rlang’
Warning in install.packages :
problem copying C:\Users\thebi\Documents\R\win-library\4.1\00LOCK\rlang\libs\x64\rlang.dll to C:\Users\thebi\Documents\R\win-library\4.1\rlang\libs\x64\rlang.dll: Permission denied
Warning in install.packages :
restored ‘rlang’
The downloaded binary packages are in
C:\Users\thebi\AppData\Local\Temp\RtmpO2wx0n\downloaded_packages
If I try to manually delete the rlang folder, it won't let me saying it's in use in another program, ever though I've closed R studio. I could force the point, but I' afraid of breaking something.
Can anyone help me figure what's going on here. I suspect once I sort this library, there will be 100 others that need the same treatment.
Upvotes: 6
Views: 6954
Reputation: 1597
The reason for this behaviour was as follows. The main R project was open in RStudio. It was inside this environment that I was experiencing the problems.
However, since my R code is actually built into a docker image, as part of a larger CI/CD controlled project, I happened to have a couple of R and Rmd files open in vscode. My vscode has several R plugins installed (it actaully promopts you to do this when it recognises an R file).
And as it turns out, vscode prevents you from working with your packages in RStudio. The message about the folder or file being open in another program must stem from vscode opening them in the background.
Upvotes: 6