##// END OF EJS Templates
Merge pull request #10923 from takluyver/doc-kernel-install-code-blk...
Merge pull request #10923 from takluyver/doc-kernel-install-code-blk Fix rst for code block

File last commit:

r24080:01a6b2fd
r24081:474d48d9 merge
Show More
kernel_install.rst
106 lines | 3.7 KiB | text/x-rst | RstLexer
Jonathan Frederic
Add files remove in https://github.com/jupyter/notebook/pull/124
r21584 .. _kernel_install:
Min RK
document kernel installation in multiple environments
r21710 Installing the IPython kernel
=============================
Jonathan Frederic
Add files remove in https://github.com/jupyter/notebook/pull/124
r21584
Thomas Kluyver
Clarify kernel installation instructions...
r21968 .. seealso::
:ref:`Installing Jupyter <jupyter:install>`
The IPython kernel is the Python execution backend for Jupyter.
Thomas Kluyver
Improve kernel installation docs...
r21878 The Jupyter Notebook and other frontends automatically ensure that the IPython kernel is available.
However, if you want to use a kernel with a different version of Python, or in a virtualenv or conda environment,
you'll need to install that manually.
Min RK
document kernel installation in multiple environments
r21710
Thomas Kluyver
Clarify kernel installation instructions...
r21968 Kernels for Python 2 and 3
--------------------------
Matthias Bussonnier
clarify Python 2 kernels install
r23954 If you're running Jupyter on Python 3, you can set up a Python 2 kernel after
checking your version of pip is greater than 9.0::
python2 -m pip --version
Then install with ::
Thomas Kluyver
Clarify kernel installation instructions...
r21968
python2 -m pip install ipykernel
python2 -m ipykernel install --user
Jonathan Frederic
Add files remove in https://github.com/jupyter/notebook/pull/124
r21584
Thomas Kluyver
Clarify kernel installation instructions...
r21968 Or using conda, create a Python 2 environment::
conda create -n ipykernel_py2 python=2 ipykernel
source activate ipykernel_py2 # On Windows, remove the word 'source'
Thomas Kluyver
Improve kernel installation docs...
r21878 python -m ipykernel install --user
Min RK
document kernel installation in multiple environments
r21710
Matthias Bussonnier
clarify Python 2 kernels install
r23954 .. note::
Thomas Kluyver
Update kernel_install.rst
r23956 IPython 6.0 stopped support for Python 2, so
installing IPython on Python 2 will give you an older version (5.x series).
Matthias Bussonnier
clarify Python 2 kernels install
r23954
Thomas Kluyver
Clarify kernel installation instructions...
r21968 If you're running Jupyter on Python 2 and want to set up a Python 3 kernel,
follow the same steps, replacing ``2`` with ``3``.
Matthias Bussonnier
take comments into account
r21816 The last command installs a :ref:`kernel spec <jupyterclient:kernelspecs>` file
for the current python installation. Kernel spec files are JSON files, which
can be viewed and changed with a normal text editor.
Min RK
document kernel installation in multiple environments
r21710 .. _multiple_kernel_install:
Thomas Kluyver
Clarify kernel installation instructions...
r21968 Kernels for different environments
----------------------------------
Min RK
document kernel installation in multiple environments
r21710
Matthias Bussonnier
Improve documentation in installing multiple kernels...
r23882 If you want to have multiple IPython kernels for different virtualenvs or conda
environments, you will need to specify unique names for the kernelspecs.
Thomas Kluyver
Clarify that example is for conda envs
r21971
Matthias Bussonnier
Improve documentation in installing multiple kernels...
r23882 Make sure you have ipykernel installed in your environement. If you are using
``pip`` to install ``ipykernel`` in a conda env, make sure ``pip`` is
Thomas Kluyver
Fix rst for code block
r24080 installed:
Matthias Bussonnier
Improve documentation in installing multiple kernels...
r23882
.. sourcecode:: bash
source activate myenv
conda install pip
conda install ipykernel # or pip install ipykernel
For example, using conda environments, install a ``Python (myenv)`` Kernel in a first
environment:
Min RK
document kernel installation in multiple environments
r21710
.. sourcecode:: bash
source activate myenv
Thomas Kluyver
Clarify kernel installation instructions...
r21968 python -m ipykernel install --user --name myenv --display-name "Python (myenv)"
Matthias Bussonnier
Improve documentation in installing multiple kernels...
r23882
And in a second environment, after making sure ipykernel is installed in it:
.. sourcecode:: bash
Min RK
document kernel installation in multiple environments
r21710 source activate other-env
Thomas Kluyver
Clarify kernel installation instructions...
r21968 python -m ipykernel install --user --name other-env --display-name "Python (other-env)"
Min RK
document kernel installation in multiple environments
r21710
Thomas Kluyver
Clarify kernel installation instructions...
r21968 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.
Piotr Przetacznik
Add more information about adding kernels to jupyter...
r22856
Piotr Przetacznik
Add additional information to installing ipython docs
r22863 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:
Piotr Przetacznik
Add more information about adding kernels to jupyter...
r22856
.. sourcecode:: bash
Piotr Przetacznik
Add additional information to installing ipython docs
r22863 /path/to/kernel/env/bin/python -m ipykernel install --prefix=/path/to/jupyter/env --name 'python-my-env'
Piotr Przetacznik
Apply grammar corrections for ipython kernels installation docs
r22869 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):
Piotr Przetacznik
Add more information about adding kernels to jupyter...
r22856
* system-wide (e.g. /usr/local/share),
* in Jupyter's env (sys.prefix/share),
* per-user (~/.local/share or ~/Library/share)
Piotr Przetacznik
Rephrase two steps installing kernel in docs
r22865 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:
Piotr Przetacznik
Add more information about adding kernels to jupyter...
r22856
.. sourcecode:: bash
ipython kernel install --prefix /tmp
Piotr Przetacznik
Rephrase two steps installing kernel in docs
r22865 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