Help with Rstan installation, please

I am installing RStan(Windows 10 OS) according to https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started

When I run
pkgbuild::has_build_tools(debug = TRUE)

I get the 'Install Build Tools. pop-up. I install and when I run
pkgbuild::has_build_tools(debug = TRUE)

I get the pop-up again.

I have scoured the forums trying multiple solutions and now I am trying to start from scratch.

> R.Version()

$platform
[1] “x86_64-w64-mingw32”

$arch
[1] “x86_64”

$os
[1] “mingw32”

$system
[1] “x86_64, mingw32”

$status
[1] “”

$major
[1] “3”

$minor
[1] “6.3”

$year
[1] “2020”

$month
[1] “02”

$day
[1] “29”

$svn rev
[1] “77875”

$language
[1] “R”

$version.string
[1] “R version 3.6.3 (2020-02-29)”

$nickname
[1] “Holding the Windsock”

Or you can do

library(rstan)
rstan_options(check = FALSE)
1 Like

Thank you for the reply! Something is still wrong. I have run through a number of threads and nothing has worked as of yet. Here are a few things I have tried to better understand the problem:

pkgbuild::with_build_tools(print(“hello”), debug = TRUE)
Error: Could not find tools necessary to compile a package
Call pkgbuild::check_build_tools(debug = TRUE) to diagnose the problem.

> pkgbuild::check_build_tools(debug = TRUE)
Error: Could not find tools necessary to compile a package
Call `pkgbuild::check_build_tools(debug = TRUE)` to diagnose the problem.

> pkgbuild::rtools_path()
[1] "C:/RBuildTools/3.5/bin"

> Sys.which("ls.exe")
ls.exe 
    "" 
> Sys.which("gcc.exe")
gcc.exe 
     ""

What is in C:/RBuildTools/3.5/bin ?

It seems that you are using R 3.6.3 but trying to use the build tools under C:/RBuildTools/3.5 . I would uninstall the 3.5 stuff if you are not using it.

Are you suggesting that I install an older version of build tools? I tried that and am still not successful. Again, I appreciate your help. This is a fantastic community

No, I mean if you get rid of R 3.5, then it will install the RTools that works with R 3.6.

Where are you seeing that I have R 3.5? Everywhere I look suggests I have 3.6.3. I am walking around in the dark a bit. Thank you for your patience

It is possible that you have already uninstalled R 3.5.x, in which case you just need to uninstall RBuildTools. It will get reinstalled for 3.6 when you do pkgbuild::has_build_tools(TRUE) from R 3.6.x.

No dice. I uninstalled R, RStudio, all of my packages, Rtools, and removed all of the R related Path variables.
I then installed R, Rstudio, RStan, and Rtools.

I ran pkgbuild::has_build_tools(debug = TRUE) and I still get the pop-up to install Rtools.
and
[1] FALSE

I tried running this :

library(rstan)
stancode <- 'data {real y_mean;} parameters {real y;} model {y ~ normal(y_mean,1);}'
mod <- stan_model(model_code = stancode, verbose = TRUE)

and received the following error:

Error in compileCode(f, code, language = language, verbose = verbose) : 
  Compilation ERROR, function(s)/method(s) not created! file366c67595a4f.cpp:6:36: warning: ISO C99 requires whitespace after the macro name
 #define STAN__SERVICES__COMMAND_HPP#include <boost/integer/integer_log2.hpp>

Finally have it working. It was a combination of setting Environment variables and folder security settings.
Thank you for your help.