Rstan on Windows

Don’t worry about the

In system(paste(CXX, ARGS), ignore.stdout = TRUE, ignore.stderr = TRUE) :
‘C:/rtools40/usr/mingw_/bin/g++’ not found

Some of the other things should be fixed by the imminent StanHeaders. Others may need to be fixed in the inline package.

5 Likes

By “don’t worry” do you mean it is (or will be) fixed or just that it can be ignored?

1 Like

Both

Maybe the solution is given somewhere on this thread, but it is just too long and confusing.

I have just reinstalled rstan and tried to run the schools example in https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started

When I run fit <- stan(file = 'schools.stan', data = schools_dat), I get this error:
“Error in file(con, “r”) : cannot open the connection
In addition: Warning messages:
1: In system(paste(CXX, ARGS), ignore.stdout = TRUE, ignore.stderr = TRUE) :
‘C:/rtools40/usr/mingw_/bin/g++’ not found
2: In system(cmd, intern = !verbose) :
running command ‘C:/PROGRA~1/R/R-40~1.2/bin/x64/R CMD SHLIB file2968734e19d4.cpp 2> file2968734e19d4.cpp.err.txt’ had status 1
3: In file(con, “r”) :
cannot open file ‘file2968734e19d4.cpp.err.txt’: No such file or directory
Error in sink(type = “output”) : invalid connection”

Any pointer?
I thought that running file.edit("~/.R/Makevars.win") and file.edit("~/.R/Makevars") was not needed anymore. Should I try?


sessionInfo()
R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19041)
Matrix products: default
locale:
[1] LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=English_United Kingdom.1252
[3] LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C
[5] LC_TIME=English_United Kingdom.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] rstan_2.21.2 ggplot2_3.3.2 StanHeaders_2.21.0-5
loaded via a namespace (and not attached):
[1] Rcpp_1.0.5 pillar_1.4.6 compiler_4.0.2 prettyunits_1.1.1
[5] tools_4.0.2 pkgbuild_1.1.0 jsonlite_1.7.0 lifecycle_0.2.0
[9] tibble_3.0.3 gtable_0.3.0 pkgconfig_2.0.3 rlang_0.4.7
[13] cli_2.0.2 rstudioapi_0.11 parallel_4.0.2 curl_4.3
[17] xfun_0.16 loo_2.3.1 gridExtra_2.3 withr_2.2.0
[21] dplyr_1.0.1 generics_0.0.2 vctrs_0.3.2 stats4_4.0.2
[25] grid_4.0.2 tidyselect_1.1.0 glue_1.4.1 inline_0.3.15
[29] R6_2.4.1 processx_3.4.3 fansi_0.4.1 purrr_0.3.4
[33] callr_3.4.3 magrittr_1.5 codetools_0.2-16 matrixStats_0.56.0
[37] scales_1.1.1 ps_1.3.3 ellipsis_0.3.1 assertthat_0.2.1
[41] colorspace_1.4-1 V8_3.2.0 tinytex_0.25 RcppParallel_5.0.2
[45] munsell_0.5.0 crayon_1.3.4

I am running R via RStudio Version 1.3.1073

Hi,

try running

remotes::install_github("bgoodri/inline")

and try again.

Now I get that:
fit <- stan(file = 'schools.stan', data = schools_dat)
make cmd is
make -f “C:/PROGRA~1/R/R-40~1.2/etc/x64/Makeconf” -f “C:/PROGRA~1/R/R-40~1.2/share/make/winshlib.mk” CXX=’(CXX14) (CXX14STD)’ CXXFLAGS=’(CXX14FLAGS)' CXXPICFLAGS='(CXX14PICFLAGS)’ SHLIB_LDFLAGS=’(SHLIB_CXX14LDFLAGS)' SHLIB_LD='(SHLIB_CXX14LD)’ SHLIB=“file4383f1b50e6.dll” WIN=64 TCLBIN=64 OBJECTS=“file4383f1b50e6.o”

make would use
“C:/rtools40/mingw64/bin/“g++ -std=gnu++14 -I"C:/PROGRA~1/R/R-40~1.2/include” -DNDEBUG -I"C:/Program Files/R/R-4.0.2/library/Rcpp/include/” -I"C:/Program Files/R/R-4.0.2/library/RcppEigen/include/" -I"C:/Program Files/R/R-4.0.2/library/RcppEigen/include/unsupported" -I"C:/Program Files/R/R-4.0.2/library/BH/include" -I"C:/Program Files/R/R-4.0.2/library/StanHeaders/include/src/" -I"C:/Program Files/R/R-4.0.2/library/StanHeaders/include/" -I"C:/Program Files/R/R-4.0.2/library/RcppParallel/include/" -I"C:/Program Files/R/R-4.0.2/library/rstan/include" -DEIGEN_NO_DEBUG -DBOOST_DISABLE_ASSERTS -DBOOST_PENDING_INTEGER_LOG2_HPP -DSTAN_THREADS -DBOOST_NO_AUTO_PTR -include “C:/Program Files/R/R-4.0.2/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp” -std=c++1y -include C:/Program Files/R/R-4.0.2/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp -I “C:/Program Files/R/R-4.0.2/library/StanHeaders/include” -I “C:/Program Files/R/R-4.0.2/library/RcppEigen/include” -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c file4383f1b50e6.cpp -o file4383f1b50e6.o
if test “zfile4383f1b50e6.o” != “z”; then
if test -e “file4383f1b50e6-win.def”; then
echo “C:/rtools40/mingw64/bin/“g++ -shared -s -static-libgcc -o file4383f1b50e6.dll file4383f1b50e6-win.def file4383f1b50e6.o “C:/Program Files/R/R-4.0.2/library/rstan/lib/x64/libStanServices.a” -L"C:/Program Files/R/R-4.0.2/library/StanHeaders/libs/x64” -lStanHeaders -L"C:/Program Files/R/R-4.0.2/library/RcppParallel/lib/x64” -ltbb -L"C:/PROGRA~1/R/R-40~1.2/bin/x64" -lR ;
“C:/rtools40/mingw64/bin/“g++ -shared -s -static-libgcc -o file4383f1b50e6.dll file4383f1b50e6-win.def file4383f1b50e6.o “C:/Program Files/R/R-4.0.2/library/rstan/lib/x64/libStanServices.a” -L"C:/Program Files/R/R-4.0.2/library/StanHeaders/libs/x64” -lStanHeaders -L"C:/Program Files/R/R-4.0.2/library/RcppParallel/lib/x64” -ltbb -L"C:/PROGRA~1/R/R-40~1.2/bin/x64" -lR ;
else
echo EXPORTS > tmp.def;
“C:/rtools40/mingw64/bin/“nm file4383f1b50e6.o | sed -n ‘s/^.* [BCDRT] / /p’ | sed -e ‘/[.]refptr[.]/d’ -e ‘/[.]weak[.]/d’ | sed 's/[^ ][^ ]*/”&”/g’ >> tmp.def;
echo “C:/rtools40/mingw64/bin/“g++ -shared -s -static-libgcc -o file4383f1b50e6.dll tmp.def file4383f1b50e6.o “C:/Program Files/R/R-4.0.2/library/rstan/lib/x64/libStanServices.a” -L"C:/Program Files/R/R-4.0.2/library/StanHeaders/libs/x64” -lStanHeaders -L"C:/Program Files/R/R-4.0.2/library/RcppParallel/lib/x64” -ltbb -L"C:/PROGRA~1/R/R-40~1.2/bin/x64" -lR ;
“C:/rtools40/mingw64/bin/“g++ -shared -s -static-libgcc -o file4383f1b50e6.dll tmp.def file4383f1b50e6.o “C:/Program Files/R/R-4.0.2/library/rstan/lib/x64/libStanServices.a” -L"C:/Program Files/R/R-4.0.2/library/StanHeaders/libs/x64” -lStanHeaders -L"C:/Program Files/R/R-4.0.2/library/RcppParallel/lib/x64” -ltbb -L"C:/PROGRA~1/R/R-40~1.2/bin/x64" -lR ;
rm -f tmp.def;
fi
fi
Error in compileCode(f, code, language = language, verbose = verbose) :
g++.exe: error: Files/R/R-4.0.2/library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp: No such file or directorymake: *** [C:/PROGRA~1/R/R-40~1.2/etc/x64/Makeconf:229: file4383f1b50e6.o] Error 1
In addition: Warning message:
In system(paste(CXX, ARGS), ignore.stdout = TRUE, ignore.stderr = TRUE) :
‘C:/rtools40/usr/mingw_/bin/g++’ not found
Error in sink(type = “output”) : invalid connection

The error messages are formatted; how can I stop this automatic formatting so that you can see the true error messages?

There is currently a problem if the R library is located in a path with spaces. In your case you have it in “C:/Program Files”…

So you will need to set an alternative location. If you need guidance on that see https://stackoverflow.com/questions/31707941/how-do-i-change-the-default-library-path-for-r-packages
https://stackoverflow.com/questions/2698269/how-do-you-change-library-location-in-r

Is that error due to R? There is no possibility to fix it in our end?

(Windows has “short” path for everyfile, which are always path-free; cmdstanpy uses it)

2 Likes

There is definitely a way of fixing it, but before the fix reaches CRAN, this is the workaround.

1 Like

I will try to install packages in the user folder (in C:/Users/…). But I have taken the habit to install all packages as admin because there were sometimes weird issues with installing/running some packages (e.g. renv, rrtools).

I will be waiting for the fix then!!

I’ve reinstalled all packages in my user library (C:/Users/…/Documents/R/win-library/4.0).
I get no error anymore, even without running remotes::install_github("bgoodri/inline").

But I do get a warning:
In system(paste(CXX, ARGS), ignore.stdout = TRUE, ignore.stderr = TRUE) :
‘C:/rtools40/usr/mingw_/bin/g++’ not found

rtools40 is installed of course:
Sys.which("make")
make
“C:\rtools40\usr\bin\make.exe”

Should I still install inline?

In that case you do not need to install. You can ignore that warning. Everything should work, the warning will go away in the next release.

For anyone else encountering this topic, go to Workarounds for current Rstan Windows issues
for a summary of known issues with workarounds and advices.

1 Like

Thank you for your help. And thanks for the overview of the workarounds!
Hopefully Rstan will be running smoothly on Windows very soon.

2 Likes

Thank you for the Workaround article, I just encountered another strange behavior using Windows with R (4.0.2); when I run my script for the first time R will report:

In system(paste(CXX, ARGS), ignore.stdout = TRUE, ignore.stderr = TRUE) :
‘-E’ not found

If I run the same script for the second time R will crash.

Can you post the entire output for

example(stan_model, package = “rstan”, run.dontrun = TRUE)

Interesting, still get the same warning:

In system(paste(CXX, ARGS), ignore.stdout = TRUE, ignore.stderr = TRUE) :
  '-E' not found

However; if I run example(stan_model, package = “rstan”, run.dontrun = TRUE, verbose = True) again R won’t crash…

Entire Output (including verbose)

> example(stan_model, package = "rstan", run.dontrun = TRUE, verbose = TRUE)
Found file = ‘C:/Users/steven_kalinke/Documents/R/win-library/4.0/rstan/help/stan_model’ 
'envir' chosen:<environment: R_GlobalEnv>
encoding = "UTF-8" chosen
--> parsed 4 expressions; now eval(.)ing them:
has srcrefs:
List of 4
 $ : 'srcref' int [1:8] 8 1 8 84 1 84 8 8
  ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile' <environment: 0x000000002ff43720> 
 $ : 'srcref' int [1:8] 9 1 9 56 1 56 9 9
  ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile' <environment: 0x000000002ff43720> 
 $ : 'srcref' int [1:8] 10 1 10 45 1 45 10 10
  ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile' <environment: 0x000000002ff43720> 
 $ : 'srcref' int [1:8] 11 1 11 46 1 46 11 11
  ..- attr(*, "srcfile")=Classes 'srcfilecopy', 'srcfile' <environment: 0x000000002ff43720> 

>>>> eval(expression_nr. 1 )
		 =================

stn_md> stancode <- 'data {real y_mean;} parameters {real y;} model {y ~ normal(y_mean,1);}'
curr.fun: symbol <-
 .. after ‘expression(stancode <- 'data {real y_mean;} parameters {real y;} model {y ~ normal(y_mean,1);}')’

>>>> eval(expression_nr. 2 )
		 =================

stn_md> mod <- stan_model(model_code = stancode, verbose = TRUE)

TRANSLATING MODEL '73fc79f8b1915e8208c736914c86d1a1' FROM Stan CODE TO C++ CODE NOW.
successful in parsing the Stan model '73fc79f8b1915e8208c736914c86d1a1'.
curr.fun: symbol <-
 .. after ‘expression(mod <- stan_model(model_code = stancode, verbose = TRUE))’

>>>> eval(expression_nr. 3 )
		 =================

stn_md> fit <- sampling(mod, data = list(y_mean = 0))

SAMPLING FOR MODEL '73fc79f8b1915e8208c736914c86d1a1' NOW (CHAIN 1).
Chain 1: 
Chain 1: Gradient evaluation took 0 seconds
Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 0 seconds.
Chain 1: Adjust your expectations accordingly!
Chain 1: 
Chain 1: 
Chain 1: Iteration:    1 / 2000 [  0%]  (Warmup)
Chain 1: Iteration:  200 / 2000 [ 10%]  (Warmup)
Chain 1: Iteration:  400 / 2000 [ 20%]  (Warmup)
Chain 1: Iteration:  600 / 2000 [ 30%]  (Warmup)
Chain 1: Iteration:  800 / 2000 [ 40%]  (Warmup)
Chain 1: Iteration: 1000 / 2000 [ 50%]  (Warmup)
Chain 1: Iteration: 1001 / 2000 [ 50%]  (Sampling)
Chain 1: Iteration: 1200 / 2000 [ 60%]  (Sampling)
Chain 1: Iteration: 1400 / 2000 [ 70%]  (Sampling)
Chain 1: Iteration: 1600 / 2000 [ 80%]  (Sampling)
Chain 1: Iteration: 1800 / 2000 [ 90%]  (Sampling)
Chain 1: Iteration: 2000 / 2000 [100%]  (Sampling)
Chain 1: 
Chain 1:  Elapsed Time: 0.012 seconds (Warm-up)
Chain 1:                0.012 seconds (Sampling)
Chain 1:                0.024 seconds (Total)
Chain 1: 

SAMPLING FOR MODEL '73fc79f8b1915e8208c736914c86d1a1' NOW (CHAIN 2).
Chain 2: 
Chain 2: Gradient evaluation took 0 seconds
Chain 2: 1000 transitions using 10 leapfrog steps per transition would take 0 seconds.
Chain 2: Adjust your expectations accordingly!
Chain 2: 
Chain 2: 
Chain 2: Iteration:    1 / 2000 [  0%]  (Warmup)
Chain 2: Iteration:  200 / 2000 [ 10%]  (Warmup)
Chain 2: Iteration:  400 / 2000 [ 20%]  (Warmup)
Chain 2: Iteration:  600 / 2000 [ 30%]  (Warmup)
Chain 2: Iteration:  800 / 2000 [ 40%]  (Warmup)
Chain 2: Iteration: 1000 / 2000 [ 50%]  (Warmup)
Chain 2: Iteration: 1001 / 2000 [ 50%]  (Sampling)
Chain 2: Iteration: 1200 / 2000 [ 60%]  (Sampling)
Chain 2: Iteration: 1400 / 2000 [ 70%]  (Sampling)
Chain 2: Iteration: 1600 / 2000 [ 80%]  (Sampling)
Chain 2: Iteration: 1800 / 2000 [ 90%]  (Sampling)
Chain 2: Iteration: 2000 / 2000 [100%]  (Sampling)
Chain 2: 
Chain 2:  Elapsed Time: 0.013 seconds (Warm-up)
Chain 2:                0.015 seconds (Sampling)
Chain 2:                0.028 seconds (Total)
Chain 2: 

SAMPLING FOR MODEL '73fc79f8b1915e8208c736914c86d1a1' NOW (CHAIN 3).
Chain 3: 
Chain 3: Gradient evaluation took 0 seconds
Chain 3: 1000 transitions using 10 leapfrog steps per transition would take 0 seconds.
Chain 3: Adjust your expectations accordingly!
Chain 3: 
Chain 3: 
Chain 3: Iteration:    1 / 2000 [  0%]  (Warmup)
Chain 3: Iteration:  200 / 2000 [ 10%]  (Warmup)
Chain 3: Iteration:  400 / 2000 [ 20%]  (Warmup)
Chain 3: Iteration:  600 / 2000 [ 30%]  (Warmup)
Chain 3: Iteration:  800 / 2000 [ 40%]  (Warmup)
Chain 3: Iteration: 1000 / 2000 [ 50%]  (Warmup)
Chain 3: Iteration: 1001 / 2000 [ 50%]  (Sampling)
Chain 3: Iteration: 1200 / 2000 [ 60%]  (Sampling)
Chain 3: Iteration: 1400 / 2000 [ 70%]  (Sampling)
Chain 3: Iteration: 1600 / 2000 [ 80%]  (Sampling)
Chain 3: Iteration: 1800 / 2000 [ 90%]  (Sampling)
Chain 3: Iteration: 2000 / 2000 [100%]  (Sampling)
Chain 3: 
Chain 3:  Elapsed Time: 0.014 seconds (Warm-up)
Chain 3:                0.012 seconds (Sampling)
Chain 3:                0.026 seconds (Total)
Chain 3: 

SAMPLING FOR MODEL '73fc79f8b1915e8208c736914c86d1a1' NOW (CHAIN 4).
Chain 4: 
Chain 4: Gradient evaluation took 0 seconds
Chain 4: 1000 transitions using 10 leapfrog steps per transition would take 0 seconds.
Chain 4: Adjust your expectations accordingly!
Chain 4: 
Chain 4: 
Chain 4: Iteration:    1 / 2000 [  0%]  (Warmup)
Chain 4: Iteration:  200 / 2000 [ 10%]  (Warmup)
Chain 4: Iteration:  400 / 2000 [ 20%]  (Warmup)
Chain 4: Iteration:  600 / 2000 [ 30%]  (Warmup)
Chain 4: Iteration:  800 / 2000 [ 40%]  (Warmup)
Chain 4: Iteration: 1000 / 2000 [ 50%]  (Warmup)
Chain 4: Iteration: 1001 / 2000 [ 50%]  (Sampling)
Chain 4: Iteration: 1200 / 2000 [ 60%]  (Sampling)
Chain 4: Iteration: 1400 / 2000 [ 70%]  (Sampling)
Chain 4: Iteration: 1600 / 2000 [ 80%]  (Sampling)
Chain 4: Iteration: 1800 / 2000 [ 90%]  (Sampling)
Chain 4: Iteration: 2000 / 2000 [100%]  (Sampling)
Chain 4: 
Chain 4:  Elapsed Time: 0.013 seconds (Warm-up)
Chain 4:                0.012 seconds (Sampling)
Chain 4:                0.025 seconds (Total)
Chain 4: 
curr.fun: symbol <-
 .. after ‘expression(fit <- sampling(mod, data = list(y_mean = 0)))’

>>>> eval(expression_nr. 4 )
		 =================

stn_md> fit2 <- sampling(mod, data = list(y_mean = 5))

SAMPLING FOR MODEL '73fc79f8b1915e8208c736914c86d1a1' NOW (CHAIN 1).
Chain 1: 
Chain 1: Gradient evaluation took 0 seconds
Chain 1: 1000 transitions using 10 leapfrog steps per transition would take 0 seconds.
Chain 1: Adjust your expectations accordingly!
Chain 1: 
Chain 1: 
Chain 1: Iteration:    1 / 2000 [  0%]  (Warmup)
Chain 1: Iteration:  200 / 2000 [ 10%]  (Warmup)
Chain 1: Iteration:  400 / 2000 [ 20%]  (Warmup)
Chain 1: Iteration:  600 / 2000 [ 30%]  (Warmup)
Chain 1: Iteration:  800 / 2000 [ 40%]  (Warmup)
Chain 1: Iteration: 1000 / 2000 [ 50%]  (Warmup)
Chain 1: Iteration: 1001 / 2000 [ 50%]  (Sampling)
Chain 1: Iteration: 1200 / 2000 [ 60%]  (Sampling)
Chain 1: Iteration: 1400 / 2000 [ 70%]  (Sampling)
Chain 1: Iteration: 1600 / 2000 [ 80%]  (Sampling)
Chain 1: Iteration: 1800 / 2000 [ 90%]  (Sampling)
Chain 1: Iteration: 2000 / 2000 [100%]  (Sampling)
Chain 1: 
Chain 1:  Elapsed Time: 0.013 seconds (Warm-up)
Chain 1:                0.013 seconds (Sampling)
Chain 1:                0.026 seconds (Total)
Chain 1: 

SAMPLING FOR MODEL '73fc79f8b1915e8208c736914c86d1a1' NOW (CHAIN 2).
Chain 2: 
Chain 2: Gradient evaluation took 0 seconds
Chain 2: 1000 transitions using 10 leapfrog steps per transition would take 0 seconds.
Chain 2: Adjust your expectations accordingly!
Chain 2: 
Chain 2: 
Chain 2: Iteration:    1 / 2000 [  0%]  (Warmup)
Chain 2: Iteration:  200 / 2000 [ 10%]  (Warmup)
Chain 2: Iteration:  400 / 2000 [ 20%]  (Warmup)
Chain 2: Iteration:  600 / 2000 [ 30%]  (Warmup)
Chain 2: Iteration:  800 / 2000 [ 40%]  (Warmup)
Chain 2: Iteration: 1000 / 2000 [ 50%]  (Warmup)
Chain 2: Iteration: 1001 / 2000 [ 50%]  (Sampling)
Chain 2: Iteration: 1200 / 2000 [ 60%]  (Sampling)
Chain 2: Iteration: 1400 / 2000 [ 70%]  (Sampling)
Chain 2: Iteration: 1600 / 2000 [ 80%]  (Sampling)
Chain 2: Iteration: 1800 / 2000 [ 90%]  (Sampling)
Chain 2: Iteration: 2000 / 2000 [100%]  (Sampling)
Chain 2: 
Chain 2:  Elapsed Time: 0.02 seconds (Warm-up)
Chain 2:                0.018 seconds (Sampling)
Chain 2:                0.038 seconds (Total)
Chain 2: 

SAMPLING FOR MODEL '73fc79f8b1915e8208c736914c86d1a1' NOW (CHAIN 3).
Chain 3: 
Chain 3: Gradient evaluation took 0 seconds
Chain 3: 1000 transitions using 10 leapfrog steps per transition would take 0 seconds.
Chain 3: Adjust your expectations accordingly!
Chain 3: 
Chain 3: 
Chain 3: Iteration:    1 / 2000 [  0%]  (Warmup)
Chain 3: Iteration:  200 / 2000 [ 10%]  (Warmup)
Chain 3: Iteration:  400 / 2000 [ 20%]  (Warmup)
Chain 3: Iteration:  600 / 2000 [ 30%]  (Warmup)
Chain 3: Iteration:  800 / 2000 [ 40%]  (Warmup)
Chain 3: Iteration: 1000 / 2000 [ 50%]  (Warmup)
Chain 3: Iteration: 1001 / 2000 [ 50%]  (Sampling)
Chain 3: Iteration: 1200 / 2000 [ 60%]  (Sampling)
Chain 3: Iteration: 1400 / 2000 [ 70%]  (Sampling)
Chain 3: Iteration: 1600 / 2000 [ 80%]  (Sampling)
Chain 3: Iteration: 1800 / 2000 [ 90%]  (Sampling)
Chain 3: Iteration: 2000 / 2000 [100%]  (Sampling)
Chain 3: 
Chain 3:  Elapsed Time: 0.016 seconds (Warm-up)
Chain 3:                0.013 seconds (Sampling)
Chain 3:                0.029 seconds (Total)
Chain 3: 

SAMPLING FOR MODEL '73fc79f8b1915e8208c736914c86d1a1' NOW (CHAIN 4).
Chain 4: 
Chain 4: Gradient evaluation took 0 seconds
Chain 4: 1000 transitions using 10 leapfrog steps per transition would take 0 seconds.
Chain 4: Adjust your expectations accordingly!
Chain 4: 
Chain 4: 
Chain 4: Iteration:    1 / 2000 [  0%]  (Warmup)
Chain 4: Iteration:  200 / 2000 [ 10%]  (Warmup)
Chain 4: Iteration:  400 / 2000 [ 20%]  (Warmup)
Chain 4: Iteration:  600 / 2000 [ 30%]  (Warmup)
Chain 4: Iteration:  800 / 2000 [ 40%]  (Warmup)
Chain 4: Iteration: 1000 / 2000 [ 50%]  (Warmup)
Chain 4: Iteration: 1001 / 2000 [ 50%]  (Sampling)
Chain 4: Iteration: 1200 / 2000 [ 60%]  (Sampling)
Chain 4: Iteration: 1400 / 2000 [ 70%]  (Sampling)
Chain 4: Iteration: 1600 / 2000 [ 80%]  (Sampling)
Chain 4: Iteration: 1800 / 2000 [ 90%]  (Sampling)
Chain 4: Iteration: 2000 / 2000 [100%]  (Sampling)
Chain 4: 
Chain 4:  Elapsed Time: 0.013 seconds (Warm-up)
Chain 4:                0.013 seconds (Sampling)
Chain 4:                0.026 seconds (Total)
Chain 4: 
curr.fun: symbol <-
 .. after ‘expression(fit2 <- sampling(mod, data = list(y_mean = 5)))’
Warnmeldung:
In system(paste(CXX, ARGS), ignore.stdout = TRUE, ignore.stderr = TRUE) :
  '-E' not found

Is that the entire error?

Maybe

example(stan_model, package = “rstan”, run.dontrun = TRUE, verbose = TRUE)

Will give more info.

update my previous answer, as I don’t want to paste a wall of text (the forum needs a text spoiler function).

I just noticed that the first time the function executes (and takes longer), it produces another output. Do you want rather this one?

Yes. That one seems to be fine apart from the warning?

Thats the initial output…