I've installed pystan and am trying to verify that the installation has worked correctly.
When I go to the IPython console in Spyder and run the following code line by line, it generates the correct answer.
import pystan
model_code = 'parameters {real y;} model {y ~ normal(0,1);}'
model = pystan.StanModel(model_code=model_code)
y = model.sampling().extract()['y']
y.mean()
The line calling pystan.StanModel
takes about 30 seconds, while the other lines execute instantaneously. In the end I get the right result (about 0, e.g. 0.01 or -0.01).
However, when I run the code as a single script in Spyder, it doesn't work, and instead the console just runs forever, doesn't produce a result, and I have to manually shut down Anaconda. Why is that?
spyder --reset
spyder --defaults