Skip to content

Commit 2a47957

Browse files
committed
README: document --kernel-template in more detail
1 parent 665beeb commit 2a47957

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,39 @@ envkernel lmod --name=NAME [envkernel options] [module ...]
291291

292292

293293

294+
## Other kernels
295+
296+
Envkernel isn't specific to the IPython kernel. It defaults to
297+
ipykernel, but by using the `--kernel-template` option you can make it
298+
work with any other kernel without having to understand the internals.
299+
First, you install your other kernel normally, with some name (in this
300+
case, `R-3.6.1`). Then, you run envkernel with
301+
`--kernel-template=R-3.6.1`, which clones that (with all its support
302+
files from the kernel directory, argv, and so on), and (in this case)
303+
saves it to the same name with the `--name=R-3.6.1` option.
304+
305+
```console
306+
# Load modules and install the IRKernel normally, without envkernel
307+
$ module load r-irkernel/1.1-python3
308+
$ module load jupyterhub/live
309+
$ Rscript -e "library(IRkernel); IRkernel::installspec(name='R-3.6.1', displayname='R 3.6 module')"
310+
311+
# Use envkernel --kernel-template
312+
# - Do the normal Lmod envkernel setup
313+
# - copy the existing kernel, incuding argv, kernel.js, icon, and display name
314+
# - Save it again, to the same name, with envkernel wrapper.
315+
envkernel lmod --user --kernel-template=R-3.6.1 --name=R-3.6.1 r-irkernel/1.1-python3
316+
```
317+
318+
This way, you can wrap any arbitrary kernel to run under envkernel.
319+
Also, you can always use `--kernel-cmd` to explicitly set your kernel
320+
command to whatever is needed for any other kernel (but you have to
321+
figure out that command yourself...).
322+
323+
324+
325+
326+
294327
## How it works
295328

296329
When envkernel first runs, it sets up a kernelspec that will re-invoke
@@ -399,6 +432,10 @@ nbgrader autograde --ExecutePreprocessor.kernel_name=testcourse-0.5.9 R1_Introdu
399432
* The direct way to make a conda/virtualenv available in Jupyter is to activate the environment, then run `python -m ipykernel install [--user|--prefix=/path/to/other/env/]`. But this does *not* set up `PATH`, so calling other executables doesn't work... thus the benefit of envkernel.
400433
* [This thread](https://groups.google.com/forum/#!topic/jupyter/kQ9ZDX4rDEE) was the clue to getting a kernel inside Docker working.
401434

435+
* The following commands are essential for kernel management
436+
* `jupyter kernelspec list`
437+
* `jupyter --paths` - each `$data_path/kernels` dir is searched for kernels.
438+
402439

403440

404441

0 commit comments

Comments
 (0)