Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Run All cells in notebook without opening browser

I have an Jupyter notebook which generates the plots for some work. I would like to be able to run the notebook as part of a Makefile. So is there a way to instruct Jupyter to

1) Start a K=kernel

2) Open a specific notebook

3) Execute "Run All"

4) Shutdown the kernel

I imagine there will be issues with the security, but I can mark the notebook as trusted?

I have searched for help, but even getting the notebook to automatically Run All seems to be an issue.

For me, this is an important feature since once the exploratory part of work is over (for which the notebook is fantastic) it would be nice to quickly transition to the reproducible part!

like image 372
Greg Avatar asked Sep 09 '15 13:09

Greg


People also ask

Can I run Jupyter notebook without browser?

Step 1: Run Jupyter Notebook from remote machine Log-in to your remote machine the usual way you do. In most cases, this is simply done via an ssh command. Once the console shows, type the following: remoteuser@remotehost: jupyter notebook --no-browser --port=XXXX # Note: Change XXXX to the port of your choice.

How do I run Jupyter notebook all at once?

You can run the whole notebook in a single step by clicking on the menu Cell -> Run All. To restart the kernel (i.e. the computational engine), click on the menu Kernel -> Restart.


1 Answers

I think you're looking for the jupyter nbconvert command.

Read an input notebook and produce a static HTML result:

jupyter nbconvert --to=html --ExecutePreprocessor.enabled=True notebook.ipynb

Read an input notebook and save the output back to the original:

jupyter nbconvert --to=notebook --inplace --ExecutePreprocessor.enabled=True notebook.ipynb

For more help, take a look at the help page:

jupyter nbconvert --help
like image 155
shad Avatar answered Sep 28 '22 03:09

shad