Error configuring R for Windows (4.3) to work with Rtools (4.3) without Admin privileges

140 views Asked by At

I need to build a homegrown R package that incorporates C code, so I need Rtools. I am working on a Windows 10 virtual machine in a corporate-style environment that does not allow me to install software that require Admin privileges to run. (And whose management has an extremely reluctant/incompetent response to requests for software installs).

But I can install software locally to my home directory (eg, C:\Users\myusername\Programs\rtools43), as long as I don't need to write to the registry. I have landed in a place where I have both R for Windows and Rtools working, but devtools/pkgbuild does not seem to be able to detect Rtools.

From googling, it seems like this should just be a matter of adding the rtools locations of gcc and make to Path. I tried that, adding:

C:\Users\myusername\Programs\rtools43\usr\bin
C:\Users\myusername\Programs\rtools43\ucrt64\bin

To the front of my Path variable through CMD for Windows. I also tried setting the PATH variable in .bashrc for Rtools43 Bash, and running R in bash with the same result. (The setting-the-Path method seems like it worked in the past with a much older version of R/rtools; though it required a different variation of paths to the compile tools in rtools: How to install RTools without admin privileges on Windows)

Regardless, pkgbuild returns FALSE with find_rtools(), and throws an error for has_devel().

> library(pkgbuild)
> find_rtools()
[1] FALSE
> has_devel()
Error: Could not find tools necessary to compile a package
Call `pkgbuild::check_build_tools(debug = TRUE)` to diagnose the problem.
> pkgbuild::check_build_tools(debug = TRUE)
Error: Could not find tools necessary to compile a package
Call `pkgbuild::check_build_tools(debug = TRUE)` to diagnose the problem.
> check_compiler()
[1] TRUE
> check_rtools()
Error: Rtools is not installed.
> check_rtools(debug=TRUE)
Error: Rtools is not installed.

The error has_devel() returns is keeping me from building my package as devtools apparently calls has_devel() before trying to compile the package and halts at the error.

Note check_compiler() is TRUE. Sys.which("gcc") (and make, ls, bash) are all returning their correct locations. It actually seems like I can compile packages. It's just pkgbuild/devtools that won't work because they think they don't have rtools. My instinct is that something is broken with pkgbuild (pkgbuild_1.4.2). Or the current version of R for Windows just has to have the registry entries to work with rtools; though my understanding is that it is supposed to check PATH before looking for rtools in the registry.

Or it's possible I just need an accurate list of the current paths required for R 4.3 to find rtools 4.3. Does anyone know for sure what paths are required?

I have also not been able to discover what exactly has_devel() is looking for through googling or reading the R help files. Does anyone know? That would definitely be a clue towards what I would need to include on the PATH.

If you even have some hints that could move me in the right direction, that would be super helpful. Thanks so much!

0

There are 0 answers