cmdstanpy icon indicating copy to clipboard operation
cmdstanpy copied to clipboard

fit.summary() not working in jupyter notebooks

Open filippoferrari opened this issue 2 years ago • 8 comments

Summary:

fit.summary() crashes when run in a jupyter notebook.

Description:

fit.summary() and fit.diagnose() don't work when following the Hello World tutorial in a jupyter notebook.

The tutorial works fine when run as a python file.

Additional Information:

Error RuntimeError: Command ['/Users/ff/.cmdstan/cmdstan-2.34.1/bin/diagnose', '/var/folders/2r/tmwm99ns51qfspk50vj23snh0000gn/T/tmpvoigfpsl/bernoulliomselojt/bernoulli-20240408175756_1.csv', '/var/folders/2r/tmwm99ns51qfspk50vj23snh0000gn/T/tmpvoigfpsl/bernoulliomselojt/bernoulli-20240408175756_2.csv', '/var/folders/2r/tmwm99ns51qfspk50vj23snh0000gn/T/tmpvoigfpsl/bernoulliomselojt/bernoulli-20240408175756_3.csv', '/var/folders/2r/tmwm99ns51qfspk50vj23snh0000gn/T/tmpvoigfpsl/bernoulliomselojt/bernoulli-20240408175756_4.csv'] terminated by signal 6 Unknown error: -6

Current Version:

INSTALLED VERSIONS
---------------------
python: 3.12.2 | packaged by conda-forge | (main, Feb 16 2024, 20:54:21) [Clang 16.0.6 ]
python-bits: 64
OS: Darwin
OS-release: 23.4.0
machine: arm64
processor: arm
byteorder: little
LC_ALL: None
LANG: None
LOCALE: (None, 'UTF-8')
cmdstan_folder: /Users/ff/.cmdstan/cmdstan-2.34.1
cmdstan: (2, 34)
cmdstanpy: 1.2.2
pandas: 2.2.1
xarray: 2024.3.0
tqdm: 4.66.2
numpy: 1.26.4

filippoferrari avatar Apr 08 '24 17:04 filippoferrari

I wonder if this has something to do with one being run under ARM and one under x86

Did you install cmdstan with conda or with install_cmdstan?

WardBrian avatar Apr 08 '24 22:04 WardBrian

It was through conda - it's quite weird because, when I run the notebook, all the processes in the activity monitor are ARM.

I tried to run install_cmdstan from a notebook and it fails, while it works fine through repl in the terminal.

filippoferrari avatar Apr 08 '24 22:04 filippoferrari

Are all the processes in ARM when run from the terminal as well?

WardBrian avatar Apr 09 '24 13:04 WardBrian

From what I can see yes - unless they're so quick that they won't show in the activity monitor

filippoferrari avatar Apr 10 '24 13:04 filippoferrari

From the jupyter notebook, can you try running the commands directly? Even just !/Users/ff/.cmdstan/cmdstan-2.34.1/bin/diagnose --help might be helpful to see the output of

WardBrian avatar Apr 10 '24 14:04 WardBrian

Hi Brian, Apologies for the slow reply. !/Users/ff/.cmdstan/cmdstan-2.34.1/bin/diagnose --help returns zsh:1: no such file or directory: /Users/ff/.cmdstan/cmdstan-2.34.1/bin/diagnose both from jupyter and command line. The example notebook still runs though.

This is the content of

> ls /Users/ff/.cmdstan/cmdstan-2.34.1/bin/

linux-stanc   mac-stanc     stanc         windows-stanc

filippoferrari avatar Apr 15 '24 11:04 filippoferrari

Very odd that those files are now missing - it sounds similar to some sporadic issues we've heard with code signing: https://discourse.mc-stan.org/t/cmdstanpy-reduce-sum-doesnt-produce-executable/33637/14

This seems to be an OS issue for the newer macs where sometimes they think an executable is invalid and delete it.

WardBrian avatar Apr 15 '24 13:04 WardBrian

Thank you, I wasn't aware of this issue. When I get some time I'll see if other installation methods would fix this

filippoferrari avatar Apr 16 '24 16:04 filippoferrari