AttributeError: module 'stan' has no attribute 'misc'

When I import pystan I get this error: ModuleNotFoundError: No module named ‘pystan’. From another forum thread, I now import stan (instead of pystan) (pystan==3.3.0).

However, the problem happens when I use stan.misc.stan_rdump . The error is: AttributeError: module ‘stan’ has no attribute ‘misc’.

Please advise. Thanks.

That functionality is not supported by pystan (3.x).

I recommend you to use JSON format to use with CmdStan (if needed for it).

What is your need for that function?

Thanks! It’s for CmdStan. Is the function json.dumps()?

When I use json.dumps(), I run into this error: “TypeError: Object of type ndarray is not JSON serializable”

Ok, then I recommend you to use CmdStanPy

There is a write_stan_json function that can handle also numpy data.

https://mc-stan.org/cmdstanpy/api.html#write-stan-json