From 41bc8e5ec492820b32f60122dd178300f7e01240 2016-09-13 11:37:26 From: Min RK Date: 2016-09-13 11:37:26 Subject: [PATCH] Merge pull request #9939 from pprzetacznik/patch-1 Add more information about adding kernels to jupyter --- diff --git a/docs/source/install/kernel_install.rst b/docs/source/install/kernel_install.rst index c34287d..aa38964 100644 --- a/docs/source/install/kernel_install.rst +++ b/docs/source/install/kernel_install.rst @@ -53,3 +53,28 @@ For example, using conda environments: The ``--name`` value is used by Jupyter internally. These commands will overwrite any existing kernel with the same name. ``--display-name`` is what you see in the notebook menus. + +Using virtualenv or conda envs, you can make your IPython kernel in one env available to Jupyter in a different env. To do so, run ipykernel install from the kernel's env, with --prefix pointing to the Jupyter env: + +.. sourcecode:: bash + + /path/to/kernel/env/bin/python -m ipykernel install --prefix=/path/to/jupyter/env --name 'python-my-env' + +Note that this command will create a new configuration for the kernel in one of the prefered location (see ``jupyter --paths`` command for more details): + +* system-wide (e.g. /usr/local/share), +* in Jupyter's env (sys.prefix/share), +* per-user (~/.local/share or ~/Library/share) + +If you want to edit the kernelspec before installing it, you can do so in two steps. +First, ask IPython to write its spec to a temporary location: + +.. sourcecode:: bash + + ipython kernel install --prefix /tmp + +edit the files in /tmp/share/jupyter/kernels/python3 to your liking, then when you are ready, tell Jupyter to install it (this will copy the files into a place Jupyter will look): + +.. sourcecode:: bash + + jupyter kernelspec install /tmp/share/jupyter/kernels/python3