Hello
I am trying to install rstan in RStudio using a university controlled computer that I have admin authority on. My issues has been discussed in numerous other forums but nothing is working for me. I have been following the more recent forum post Problems getting Stan to run after upgrading to R 4.0.2 - #6 by Chris_Dalton.
I have tried two forms of installing.
install.packages("rstan")
install.packages("rstan", type = "source")
However the source option gives me a series of errors and DOES NOT install the package while the standard installation procedure seems to install but still doesnāt run any models.
I have tried various versions of the Makevars.win file creation using
cat("CXX14FLAGS += -O3 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2",file = "~/.R/Makevars.win", sep = "\n", append = FALSE)
or putting the following in the Makevars.win file.
CXX14FLAGS += -O3 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2
CXX = C:\rtools40\mingw_64\bin\g++
Now regardless of what I do when I run the example code:
example(stan_model, run.dontrun = TRUE, verbose=TRUE)
I get the following consistent error
Error in compileCode(f, code, language = language, verbose = verbose) :
from file4e0c312d2e87.cpp:14:C:/Users/n9401849/OneDrive - Queensland University of Technology/Documents/R/win-library/4.0/BH/include/boost/fusion/include/make_fused.hpp:11:10: fatal error: C:/Users/n9401849/OneDrive - Queensland University of Technology/Documents/R/win-library/4.0/BH/include/boost/fusion/functional/generation/make_fused.hpp: Invalid argument #include <boost/fusion/functional/generation/make_fused.hpp> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~compilation terminated.make: *** [C:/PROGRA~1/R/R-40~1.5/etc/x64/Makeconf:229: file4e0c312d2e87.o] Error 1
In addition: Warning messages:
1: In find.package(package, lib.loc, verbose = verbose) :
package ābaseā found more than once, using the first from
āC:/PROGRA~1/R/R-40~1.5/library/baseā,
āC:/Program Files/R/R-4.0.5/library/baseā
2: In system(paste(CXX, ARGS), ignore.stdout = TRUE, ignore.stderr = TRUE) :
'C:/rtools40/usr/mingw_/bin/g++' not found
Any help here would be fantastic. Thank you in advance. Note that throughout these tests I have paused OneDrive syncing as Iām aware this can cause issues.
- Operating System: Windows 10 Enterprise
- RStan Version: 2.21.2
A bit more information below
> tools::Rcmd(c('config', 'CXX11'))
C:/rtools40/mingw64/bin/g++
> devtools::session_info("rstan")
- Session info -----------------------------------------------------------------------------------
setting value
version R version 4.0.5 (2021-03-31)
os Windows 10 x64
system x86_64, mingw32
ui RStudio
language (EN)
collate English_Australia.1252
ctype English_Australia.1252
tz Australia/Brisbane
date 2021-05-14
> Sys.getenv("PATH")
[1] "C:\\rtools40\\usr\\bin;C:\\Program Files\\R\\R-4.0.5\\bin\\x64;C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\javapath_target_338484;C:\\Windows\\System32;C:\\Windows;C:\\Windows\\System32\\wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.0;C:\\Windows\\System32\\OpenSSH;C:\\Users\\n9401849\\AppData\\Local\\Microsoft\\WindowsApps"
> Sys.getenv("BINPREF")
[1] ""
> readLines("~/.R/Makevars.win")
[1] "CXX14FLAGS += -O3 -mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2"
[2] "CXX = C:\\rtools40\\mingw_64\\bin\\g++ "
Warning message:
In readLines("~/.R/Makevars.win") :
incomplete final line found on '~/.R/Makevars.win'
> readLines("~/.Renviron")
[1] "PATH=\"${RTOOLS40_HOME}\\usr\\bin;${PATH}\""
> readLines("~/.Rprofile")
Error in file(con, "r") : cannot open the connection
In addition: Warning message:
In file(con, "r") :
cannot open file 'C:/Users/n9401849/OneDrive - Queensland University of Technology/Documents/.Rprofile': No such file or directory