Permission denied on .dll file when installing package - r

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.

Related

Library installation issues- rlang

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).

Warnings in rJava installation on Ubuntu 16.04 32 bit, probably linked to XLConnectJars installation fail

When installing rJava, the install completes successfully, but there are loads and loads of warnings in the process. This is the first one:
jri_glue.c: In function ‘PushToREXP’:
jri_glue.c:24:15: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
jpar[1].j = (jlong) robj;
^
jri_glue.c: In function ‘RReleaseREXP’:
jri_glue.c:52:11: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
SEXP x = (SEXP) r;
^
This is the second block of warnings:
warning: [options] bootstrap class path not set in conjunction with -source 1.4
warning: [options] source value 1.4 is obsolete and will be removed in a future release
warning: [options] target value 1.4 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
4 warnings
Here are the first lines of the third block of warnings, which in total contains almost 500 lines:
In file included from Rengine.c:4:0:
Rengine.c: In function ‘Java_org_rosuda_JRI_Rengine_rniParse’:
jri.h:21:20: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
#define SEXP2L(s) ((jlong)(s))
^
Rengine.c:121:14: note: in expansion of macro ‘SEXP2L’
return SEXP2L(pstr);
^
The reason why I think there is a problem is the following: When I try to install another package that depends on rJava, namely XLConnectJars, I get a segmentation fault:
> install.packages("XLConnectJars")
[...]
* installing *source* package ‘XLConnectJars’ ...
** Paket ‘XLConnectJars’ erfolgreich entpackt und MD5 Summen überprüft
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded
Segmentation fault (core dumped)
ERROR: loading failed
Why is this happening, what can I do about this?
In June / July 2017, similar problems appeared after the update to kernel 4.4.0-81-generic, but the kernel has since been patched:
https://github.com/miraisolutions/xlconnect/issues/70
(My current kernel is 4.10.0-35-generic.)
Also, the suggested workarounds there and in related threads (like increasing the thread stack size using the -Xss2048k option) do not work on my machine.
Installing rJava via sudo apt-get install r-cran-rjava as suggested in numerous places did not help, either.
My java version is
~$ java -version
openjdk version "1.8.0_131"
OpenJDK Runtime Environment (build 1.8.0_131-8u131-b11-2ubuntu1.16.04.3-b11)
OpenJDK Server VM (build 25.131-b11, mixed mode)
and sessionInfo() returns
R version 3.4.2 (2017-09-28)
Platform: i686-pc-linux-gnu (32-bit)
Running under: Ubuntu 16.04.3 LTS
Matrix products: default
BLAS: /usr/lib/libblas/libblas.so.3.6.0
LAPACK: /usr/lib/lapack/liblapack.so.3.6.0
locale:
[1] LC_CTYPE=de_DE.UTF-8 LC_NUMERIC=C LC_TIME=de_DE.UTF-8
[4] LC_COLLATE=de_DE.UTF-8 LC_MONETARY=de_DE.UTF-8 LC_MESSAGES=de_DE.UTF-8
[7] LC_PAPER=de_DE.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=de_DE.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] rJava_0.9-8
loaded via a namespace (and not attached):
[1] compiler_3.4.2 tools_3.4.2
Thanks for any help.

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

Install Rcartogram: error on R CMD INSTALL

I am trying to use the Rcartogram package. After following the instructions in the answer by Geoff, I received an error that I can't resolve:
C:\R\R-3.2.3\library\Rcartogram>R CMD INSTALL --debug .
processing '.'
a directory
* installing to library 'C:/R/R-3.2.3/library'
* build_help_types=
* DBG: 'R CMD INSTALL' now doing do_install()
* created lock directory 'C:/R/R-3.2.3/library/00LOCK-Rcartogram'
ERROR: cannot install to srcdir for package 'Rcartogram'
* removing C:/R/R-3.2.3/library/Rcartogram
I have tried running R CMD INSTALL in other directories, as well as changing the flags as suggested in the linked answer. They either return the same error, or an error that there is no packages specified. What can I do to debug this error?
sessionInfo()
R version 3.2.3 (2015-12-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows >= 8 x64 (build 9200)
locale:
[1] LC_COLLATE=English_Australia.1252 LC_CTYPE=English_Australia.1252
[3] LC_MONETARY=English_Australia.1252 LC_NUMERIC=C
[5] LC_TIME=English_Australia.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] tools_3.2.3

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