Where are print statements? (PyStan)

I’m trying to debug an Initialization failed error using print statements interspersed in my code (in PyStan). However, when I run fit = model.sampling(), I don’t see any printed output. How do I see my print statements?

This could be a bug. Do the print statements show up in cmdstan or cmdstanpy?

This is often due to problems with a Jupyter kernel swallowing I/O. Any resolution will depend on the details of what version of PyStan you’re running and in what environment you’re running it.

I’m using PyStan 2.19.1.1 in a Python notebook on Databricks.

I’ve never been able to run PyStan 2.19.1.1 through Jupyter without the messages being swallowed (this is a Jupyter issue – everything prints fine when running from the command line Python REPL). I’m guessing that Databricks also uses a Jupyter kernel which would mean that unfortunately there’s not much you can do to access the print statements.

1 Like

Thanks!