Is there a way to cache and reuse a compiled Stan model in pystan 3?

In pystan 3, I see that the supported workflow is:

posterior =, data=schools_data)
fit = posterior.sample(num_chains=4, num_samples=1000)

whereas in the supported workflow in pystan 2 we could easily cache a compiled Stan model and reuse it with a different data set, or even pickle the compiled model and train it on a different machine (with the same installation).

Is there currently a work-around to enable compiled model cacheing? Or any plans to support the ‘legacy’ workflow in pystan 3?


Models are cached by default, so no need to do anything from userside.