IPython / JUpyter interactive laptop not working

Does anyone know if it is possible to start the IPython / Jupyter laptop non-interactively from the command line and get the resulting .ipynb file saved with the launch results. If this is not yet possible, how difficult would it be to use phantomJS to turn the kernel on or off and turn the web server on and off?

To be more specific, let's say I already have an original.ipynb laptop, and I want to re-run all the cells in this laptop and save the results in the new.ipynb new laptop, but do it with one command in the line command, without requiring interactions neither in the browser, nor for closing the kernel or web server, and if it is not assumed that the kernel or web server is already running.

command example:

$ ipython notebook run original.ipynb --output=new.ipynb

+72
ipython ipython-notebook jupyter-notebook
Jul 28 '13 at 5:38 on
source share
4 answers

Yes, it’s possible and easy, it will (basically) be in the IPython kernel for 2.0, I would suggest looking at these examples for now.

[edit]

Now it is in Jupyter NbConvert. NbConvert comes with the Preprocessor group, which are disabled by default, two of which ( ClearOutputPreprocessor and ExecutePreprocessor ) are of interest. You can include them in your (local | global) configuration file via c.<PreprocessorName>.enabled=True (uppercase, which is python), or on the command line with --ExecutePreprocessor.enabled=True save the rest of the command as usual .

--ExecutePreprocessor.enabled=True has a convenient alias --execute , which can be used in the latest version of NbConvert. It can be combined with --inplace if desired

For example, convert to html after starting the laptop without a head:

$ jupyter nbconvert --to=html --execute RunMe.ipynb

convert to pdf after deleting files

$ ipython nbconvert --to=pdf --ClearOutputPreprocessor.enabled=True RunMe.ipynb

This (of course) works with non-python kernels by creating a <insert-your-language-here> kernel if you set --profile=<your fav profile> . The conversion can be very lengthy, as he needs to restart the laptop. Converting laptops to laptops can be done using the --to=notebook option.

There are various other parameters (timeout, resolve errors, ...) that may need to be set / disabled depending on the use case. See the Documentation, and of course jupyter nbconert --help and --help-all for more details.

+62
Jul 28 '13 at 23:04 on
source share

Until this functionality becomes part of the kernel, I put together a small command-line application that does exactly what you want. It is called runipy, and you can install it with pip install runipy . source and readme are on github .

+20
Sep 20 '13 at 3:38 on
source share

To cover some functions, such as parallel working or input parameters, you can set jupyter-runner

 pip install jupyter-runner 

Readme on github: https://github.com/omar-masmoudi/jupyter-runner

+1
Mar 09 '17 at 23:03
source share

You can simply start the iPython-Notebook server through the command line:

 ipython notebook --pylab inline 

This will start the server in non-interactive mode, and all output will be printed under the code. Then you can save the .ipynb file that contains the code and output.

-5
Jul 28 '13 at 9:25 am
source share



All Articles