orbit icon indicating copy to clipboard operation
orbit copied to clipboard

Models cannot be compiled from within a jupyter lab notebook

Open johann-petrak opened this issue 7 months ago • 2 comments

I tried to use orbit models from within a jupyter lab notebook and I get the following error:

ValueError: Failed to compile Stan model '[/home/johann/software/anaconda/envs/sipfront/lib/python3.11/site-packages/orbit/stan/lgt.stan](http://localhost:8888/home/johann/software/anaconda/envs/sipfront/lib/python3.11/site-packages/orbit/stan/lgt.stan)'. Console:
make: *** No rule to make target '[/home/johann/software/anaconda/envs/sipfront/lib/python3.11/site-packages/orbit/stan/lgt](http://localhost:8888/home/johann/software/anaconda/envs/sipfront/lib/python3.11/site-packages/orbit/stan/lgt)'. Stop.

Command ['make', 'STANCFLAGS+=--filename-in-msg=lgt.stan', '[/home/johann/software/anaconda/envs/sipfront/lib/python3.11/site-packages/orbit/stan/lgt](http://localhost:8888/home/johann/software/anaconda/envs/sipfront/lib/python3.11/site-packages/orbit/stan/lgt)']
	error during processing No such file or directory

It seems that when running in a notebook, orbit uses a markdown link instead of the actual file path in the make command for compiling the model. Since this is a situation that should be easy to detect, it should also be easy to fix and avoid.

  • OS: Ubuntu 24.04
  • Python Version: 3.11.13
  • orbit 1.1.4.9
  • cmdstanpy 1.2.5
  • jupyter 1.1.1
  • jupyterlab 4.4.3
  • jupyter_server 2.16.0
  • jupyterlab_server 2.27.3
  • notebook 7.4.3

johann-petrak avatar Jun 20 '25 09:06 johann-petrak

Do you pip install inside the notebook?

swotai avatar Jun 22 '25 15:06 swotai

No since I am usually using many notebooks in a development project, my workflow is:

  • create a conda environment
  • install all the dependencies, including orbit, jupyterlab, ipykernel into it
  • create a kernel for the project based on that environment: python -m ipykernel install --user --name=projectname
  • activate that kernel for the notebooks I create

johann-petrak avatar Jun 22 '25 15:06 johann-petrak