6

I am running a jupyter notebook script using Papermill's python client. While running, I want to specify the kernel. However, the script ran within the same kernel as my active python shell(through which I made the API call to papermill in order to run the notebook's script).

I tried looking in the documentation(https://papermill.readthedocs.io/en/latest/usage-execute.html#execute-via-the-python-api) but in vain.

import papermill as pm
pm.execute_notebook( 'dfnjofnei.ipynb', 'dfnjofnei_output.ipynb' )
Aviral Srivastava
  • 4,058
  • 8
  • 29
  • 81

2 Answers2

8

Not sure if this is too late now, but you can check this:

papermill {input_path} {output_path} -k {kernel_name}
jli
  • 83
  • 1
  • 5
4

The documentation is not comprehensive. You can find other configurable args here: https://github.com/nteract/papermill/blob/main/papermill/execute.py

To specify the kernel when calling the API, just supply kernel_name, for example:

import papermill as pm
pm.execute_notebook(
    'input.ipynb',
    kernel_name='python3'
)

(I tried that and it worked)

nvincent
  • 41
  • 1