I have been struggling for a day to get Rstan installed and working on my Windows 10 machine and I cannot figure out what isn’t working, even though my problem seems to be similar to some I’ve found on this forum by googling. I think it has something to do with my path and where R is looking for g++ or something. I was tinkering with my path variables and wonder if I messed something up. The errors I’m reporting now are after a clean reinstall of R 4.0.2 and Rtools 40.
Right now, I was able to install Rstan and load the library. When I call stan_demo()
to test it I get
Error: package or namespace load failed for ‘rstan’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘matrixStats’
If I try install.packages("matrixStats")
, I get the following error:
C:/Rtools/mingw32/bin/gcc -I"C:/PROGRA~1/R/R-40~1.2/include" -DNDEBUG -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c 000.init.c -o 000.init.o
sh: C:/Rtools/mingw32/bin/gcc: No such file or directory
make: *** [C:/PROGRA~1/R/R-40~1.2/etc/i386/Makeconf:222: 000.init.o] Error 127
ERROR: compilation failed for package 'matrixStats'
Here is the output from a few other things that may be relevant based on problems that seem similar to mine:
Sys.getenv("BINPREF")
[1] "C:/Rtools/mingw$(WIN)/bin/"
Sys.getenv("PATH")
[1] "C:\\rtools40\\usr\\bin;C:\\Program Files\\R\\R-4.0.2\\bin\\x64;C:\\RBuildTools\\3.5\\bin;C:\\Program Files\\Amazon Corretto\\jdk1.8.0_212\\bin;C:\\Program Files (x86)\\Measurement Computing\\DAQ\\;C:\\Program Files\\ImageMagick-7.0.8-Q16;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files\\Calibre2\\;C:\\Program Files\\nodejs\\;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\Program Files\\PuTTY\\;C:\\HashiCorp\\Vagrant\\bin;C:\\ProgramData\\chocolatey\\bin;C:\\Program Files\\Git\\cmd;C:\\Program Files\\Docker\\Docker\\resources\\bin;C:\\ProgramData\\DockerDesktop\\version-bin;C:\\rtools40\\usr\\bin;C:\\rtools40\\mingw64\\bin;C:\\Users\\wittm094\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Program Files\\qpdf-8.3.0\\bin;C:\\Users\\wittm094\\AppData\\Roaming\\npm;C:\\Users\\wittm094\\AppData\\Roaming\\TinyTeX\\bin\\win32;C:\\Program Files (x86)\\FAHClient"
writeLines(readLines(file.path(Sys.getenv("HOME"), ".R/Makevars")))
Error in file(con, "r") : cannot open the connection
In addition: Warning message:
In file(con, "r") :
cannot open file 'C:\Users\wittm094\Documents/.R/Makevars': No such file or directory
- Operating System - Windows 10
- RStan Version - 2.21.2