In system(paste(cmd, "-n")) : 'make' not found. And slow speed

R version 3.6.3.
rstan version 2.19.3.
brms version 2.12.0.
Computer is custom AMD Ryzen Threadripper 2990WX 32-Core Processor, 128 GB RAM, 80MB L3 cache. Windows 10.

When trying to install and run rstan and brms on my new computer, I get the following warning after the C++ compilation:

Warning message:
In system(paste(cmd, “-n”)) : ‘make’ not found

The models seems to run fine, and it gives the same results as my other computer and rstan/brms versions. However, it seems to run very slowly! This is surprising, considering my other computer is a regular 4 core i7 desktop with 16GB of RAM. In fact, the C++ compilation seems just as slow on the fast custom computer as the i7, and the model takes much longer to run! When I go to task manager, the computer is only using 9% of CPU to run the model. My understanding is that when I set “options(mc.cores = parallel::detectCores())” that each chain in the model will use one core. So I can see that the extra cores on the custom computer might not help, but it sure seems like all that RAM and L3 cache should speed it up at least some!
Would the slow speed have to do with that error?

I have tried re-installing R, rstan, Rtools, more than once. That was suggested here Warning: 'make' not found but has not worked for me.

Any help is appreciated! I have been running models in brms for a couple years, but I don’t consider myself super computer savvy when it comes to these errors.

Do you get the 'make' not found message from

library(rstan)
example(stan_model, run.dontrun = TRUE)

?

No. I get it whenever I try to run a model (using brms).
Also, if helpful, when I type “system(“make”)” as suggested in the link, I get “127”.

When I type what you suggested, I get a long list of output that ends in:

Error in compileCode(f, code, language = language, verbose = verbose) :
Compilation ERROR, function(s)/method(s) not created! g++.exe: error: Affairs/Documents/R/win-library/3.6/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp: No such file or directory
g++.exe: error: Affairs/Documents/R/win-library/3.6/StanHeaders/include: No such file or directory
g++.exe: error: Affairs/Documents/R/win-library/3.6/RcppEigen/include: No such file or directory
make: *** [C:/PROGRA~1/R/R-36~1.3/etc/x64/Makeconf:215: file122c20fa659a.o] Error 1

In a clean R session, you need to follow

Then try doing

library(rstan)
example(example_model, run.dontrun = TRUE)

again. But if

Sys.which("make")

is not returning anything, then there likely is a problem with your RTools.

I appreciate your help!
Ok, I tried that. Now example(example_model, run.dontrun=TRUE) returns a different error:
Warning message:
In example(example_model, run.dontrun = TRUE) :
no help found for ‘example_model’

Sys.which(“make”) returns
" "
When I run a model in brms it throws that same original error.

It sounds as if you installed rstan through something other than

install.packages("rstan", dependencies = TRUE, type = "win.binary")

in which case you should first do that. Then do

pkgbuild::has_build_tools(debug = TRUE)

and then report back if

library(rstan)
example(example_model, run.dontrun = TRUE)

is still not working.

No, that is what I did. But just to make sure, I removed rstan and then reinstalled as you said. I get the warning:
In example(example_model, run.dontrun = TRUE) :
no help found for ‘example_model’

Should I just remove R and the libraries and try it all over again using install.packages(“rstan”, dependencies = TRUE, type = “win.binary”) ?

I just uninstalled R, removed all libraries, and then reinstalled it and followed your instructions for installing rstan. I get the same warning as above when running example(example_model, run.dontrun = TRUE)

When I install Rtools, in the installation dialogue box there is an option to check a box “add rtools to system PATH”. I never check that box. Should I be checking it?

You shouldn’t need to check that box or even see Rtools. Is there an example when you do help(stan_model, package = "rstan")?

It takes me to a page that says “Construct a Stan model”.

I also tried reinstalling rtools and clicking on the box regarding path. It didn’t help. I get new errors when I do that.

I also tried adding CXX14=$(BINPREF)g++ -02 -march=native -mtune=native to the Makevars file and that didn’t help either.

Well, I unintalled everything and reinstalled rstan from source. I was able to run a model in brms with no errors. When I do example(example_model, run.dontrun = TRUE) I still get:
Warning message:
In example(example_model, run.dontrun = TRUE) :
no help found for ‘example_model’

However, I do not get the “system(paste(cmd, “-n”)): ‘make’ not found” error anymore when running the a modeling brms, which is good!

The speed is still slow. It is slightly slower - comparable to the 4 core i7 with 16GB of RAM.
This is disappointing. We got this computer with the hopes of speeding up large multilevel models that have taken days to run on the other machine. Based on what I have read, I would have thought that a 32 core, 128GB of RAM, and 80MB L3 cache computer would have been at least a little faster. When I open task manager, it is using around 140MB per chain on the big computer and around 100MB on the old computer.
Any thoughts on the speed? Thanks!

I would put -O3 into Makevars{.win} but other than that, there is not a lot more than can be done to speed up brms models. You can use brms::make_stancode to get the Stan code and start making optimizations to it by hand.

-03 is already in the Makevars file.
OK…based on this thread Buying a new computer - best hardware for fast Stan performance I would have thought that the new 32 core computer would have run at least a little faster… no?
At least I can run 7 models on 7 different R sessions in the same amount of time that I run 1.

Having 32 cores is only going to help if you were running 32 chains, which is unnecessary, or if you use map_rect within each chain, which requires that you hand write / modify your code.

Ok, thanks for all of your help!

More RAM and L3 cache doesn’t help at all? Buying a new computer - best hardware for fast Stan performance

It is at least faster to be able to run so many models at once for later comparison instead of waiting for each to finish before starting another.

The solution to resolving the error was to install rstan from source, following the instructions here: