Timeout error during pystan build

I am trying to run pystan 3.2 on our new python docker container. Python version == 3.8.8. I ran the code below and I keep getting a timeout error during the stan.build portion of the code. I used the FAQ to figure out that I should be using nest-asyncio and that is working fine, now its just timeout in the loop. The error ends here:

I am sure I messed up something in the set up so any help would be appreciated!

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)

## Not getting to these steps due to error above

fit = posterior.sample(num_chains=4, num_samples=100)
eta = fit["eta"]  # array with shape (8, 4000)
df = fit.to_frame()

Haven’t seen this one before. Perhaps @ahartikainen has?

Two questions:

  1. Do things work if you run the same code outside of Jupyter?
  2. Do things work if you do not use conda?

I don’t know if it had the same root cause but I was getting this error when running a Docker container on macOS, where the container had previously worked just fine on Linux. I resolved the issue by restarting Docker on macOS (via the Docker Desktop menu on the main bar), so I think it’s a Docker/macOS problem, and if I manage to figure out exactly what the cause is then I’ll file a bug report with them. I think the issue may be related to suspending macOS? Either way, I don’t think it’s a Pystan issue. I thought I’d post an informational message here because it took me a very long time to figure out how to fix.