stan-dev / stan-dev/rstan

Error message running RStan example using R 4.4.1, rstan 2.32.6

Open
#1,139 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
R
Stars
1.1k
Forks
266
Avg merge
2h 56m
Merged PRs (30d)
1

Description

Summary

Complete documentation of verification of rstan using the RStan example.

Description:

For new stan users like myself, the below could use clarification:

  1. In the section Verifying Installation, there is missing text after "You may also see the warning:"

"To verify your installation, you can run the RStan example/test model:
example(stan_model, package = "rstan", run.dontrun = TRUE)
The model should then compile and sample. You may also see the warning:"

The error message I get is:
Compilation ERROR, function(s)/method(s) not created!
Error in compileCode(f, code, language = language, verbose = verbose) :
Error in system(paste(MAKE, p1(paste("-f", shQuote(makefiles))), "compilers"), : 'make' not foundCalls: -> .shlib_internal -> systemExecution halted

I'm unclear if this is the expected error or already indicates a different issue in the installation that I need to address.

  1. The full set of error messages I get after running library("rstan"):
    [Addressed in Getting Started]
    For execution on a local, multicore CPU with excess RAM we recommend calling
    options(mc.cores = parallel::detectCores()).

[Addressed in Getting Started]
To avoid recompilation of unchanged Stan programs, we recommend calling
rstan_options(auto_write = TRUE)

[Can you address this in the documentation?]
For within-chain threading using reduce_sum() or map_rect() Stan functions,
change threads_per_chain option:
rstan_options(threads_per_chain = 1)

[Unique to Windows, but not clear how to check "if your Makevars.win file does not contain this flag"]
Do not specify '-march=native' in 'LOCAL_CPPFLAGS' or a Makevars file

  1. Under Example 1, File -> New File -> Stan File generates a simple stan model with a header (below). It would be helpful to mention whether this should be kept or not when copying over the specified code for schools.stan and make clear
    that schools_dat.. and fit... go in the console or a separate .R file.
    //
    // This Stan program defines a simple model, with a
    // vector of values 'y' modeled as normally distributed
    // with mean 'mu' and standard deviation 'sigma'.
    //
    // Learn more about model development with Stan at:
    //
    // http://mc-stan.org/users/interfaces/rstan.html
    // https://github.com/stan-dev/rstan/wiki/RStan-Getting-Started
    //

// The input data is a vector 'y' of length 'N'.
data {
int<lower=0> N;
vector[N] y;
}

// The parameters accepted by the model. Our model
// accepts two parameters 'mu' and 'sigma'.
parameters {
real mu;
real<lower=0> sigma;
}

// The model to be estimated. We model the output
// 'y' to be normally distributed with mean 'mu'
// and standard deviation 'sigma'.
model {
y ~ normal(mu, sigma);
}

RStan Version:

2.32.6

R Version:

"R version 4.4.1 (2024-06-14 ucrt)"

Operating System:

Windows 10Pro v.22H2

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the Verifying Installation, Getting Started, and Example 1 sections referenced in the issue, using the supplied RStan example and Windows error output as the starting point. Clarify the expected make warning, RStan options, the Makevars.win guidance, the generated Stan header, and where the schools.stan, schools_dat, and fit code belong. Done means a new Windows RStan user can follow the example and distinguish an installation problem from an expected warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.