I am installing rstan for R 4.3.1.
In preparation In installed RTools43, which appears to be functioning correctly:
> Sys.which("make")
make
"C:\\PROGRA~1\\rtools43\\usr\\bin\\make.exe"
rstan also was installed without apparent issue:
> install.packages("rstan")
trying URL 'https://cloud.r-project.org/bin/windows/contrib/4.3/rstan_2.21.8.zip'
Content type 'application/zip' length 3352608 bytes (3.2 MB)
downloaded 3.2 MB
package ‘rstan’ successfully unpacked and MD5 sums checked
The problem arises when I preform the example model for rstan:
> example(stan_model, package = "rstan", run.dontrun = TRUE)
A long string of information rolls out describing the test, however at the end it stops with an error 127:
Compilation ERROR, function(s)/method(s) not created!
Error in compileCode(f, code, language = language, verbose = verbose) :
using C++ compiler: 'g++.exe (GCC) 12.2.0'using C++14Cannot create temporary file in D:\R\R-4.2.3\: No such file or directorymake: *** [C:/PROGRA~1/R/R-4.3.1/etc/x64/Makeconf:272: file7568219137a8.o] Error 127
>
I do not understand why it is trying to create temporary files in my D drive when everything (R and RTools) is installed on my C drive? Please let me know if you can identify any avenues for figuring out a solution.
Thanks you for your time!
UPDATE-I have added the commands requested by br00t:
> Sys.getenv("PATH")
[1] "C:\\Program Files\\rtools43/x86_64-w64-mingw32.static.posix/bin;
C:\\Program Files\\rtools43/usr/bin;\\usr\\bin;
> Sys.getenv("BINPREF")
[1] ""
> readLines("~/.Rprofile")
Error in file(con, "r") : cannot open the connection
In addition: Warning message:
In file(con, "r") :
cannot open file 'C:\Users\userA\Documents/.Rprofile': No such file or directory
> readLines("~/.Renviron")
[1] "TMP = 'D:/R/R-4.2.3" "PATH=\"${RTOOLS40_HOME}\\usr\\bin;${PATH}\""
> devtools::session_info("rstan")
Error in loadNamespace(x) : there is no package called ‘devtools’
Rprofile and devtools are concerning. For reference I installed this version of R after uninstalling a past edition and deleting all related library directories.
I have also had similar problems with getting cmdstanr to work.