I am trying to run a packrat:restore() to restore all libraries in my project. When I run the command I get the following message:
So it looks like the 'make' command is not present so that is why the package cannot be build. This executable is located in Rtools. I have Rtools 3.5 installed on my computer. The directory is in the PATH variable:
And sure enough I find make executable in the directory
However when I run the command Sys.which it doesn't return the path to the executable:
I don't understand what the problem is. I have googled this issues and it was either suggested to install the new version of Rtools (however I am running R version 3.6.1, and the newest version of Rtools is for R version 4.x, so this doesn't make sense for me because I don't want to install the new R version), or to add the path of Rtools to the PATH, but is already configured.
Any ideas?
Thanks, Rok
CodePudding user response:
I think you cannot have spaces in your PATH
.
To test on my system, I started with a PATH
without access to make.exe
.
Sys.which("make")
# make
# ""
file.exists("c:/rtools40/usr/bin/make.exe")
# [1] TRUE
oldpath <- Sys.getenv("PATH")
grepl("rtools", oldpath, ignore.case = TRUE)
# [1] FALSE
Sys.setenv(PATH = paste0(oldpath, "; c:\\rtools40\\usr\\bin"))
Sys.which("make")
# make
# ""
Sys.setenv(PATH = paste0(oldpath, ";c:\\rtools40\\usr\\bin"))
Sys.which("make")
# make
# "c:\\rtools40\\usr\\bin\\make.exe"
Incidentally, if you don't like all of the double-backslashes, even on windows R can use the forward-slash as its .Platform$file.sep
.
Sys.setenv(PATH = paste0(oldpath, ";c:/rtools40/usr/bin"))
Sys.which("make")
# make
# "c:\\rtools40\\usr\\bin\\make.exe"