Pystan 3.0 Issue with running stan.build function

Hi, I’m trying to run the example model given in Pystan document for the latest version of the pystan. I’m using a shared computing cluster and I installed Pystan 3.0 on a virtual environment. I was trying to run the following code in Spyder and when I run the last code ‘stan_build()’ function I’m getting the following error.

import stan

schools_code = """
data {
  int<lower=0> J;         // number of schools
  real y[J];              // estimated treatment effects
  real<lower=0> sigma[J]; // standard error of effect estimates
}
parameters {
  real mu;                // population treatment effect
  real<lower=0> tau;      // standard deviation in treatment effects
  vector[J] eta;          // unscaled deviation from mu by school
}
transformed parameters {
  vector[J] theta = mu + tau * eta;        // school treatment effects
}
model {
  target += normal_lpdf(eta | 0, 1);       // prior log-density
  target += normal_lpdf(y | theta, sigma); // log-likelihood
}
"""
schools_data = {"J": 8,
                "y": [28,  8, -3,  7, -1,  1, 18, 12],
                "sigma": [15, 10, 16, 11,  9, 11, 10, 18]}

posterior = stan.build(schools_code, data=schools_data, random_seed=1)

That is a C++ standard library error. You likely need a newer compiler. Alternatively, you can compile httpstan from scratch.

Here are the official requirements for pystan right now:

Python ≥3.7
Linux or macOS
x86-64 CPU
C++ compiler: gcc ≥9.0 or clang ≥10.0.

Hi, thank you very much. I was able to load a new version of gcc and get it to work