kernel_install.rst
55 lines
| 1.9 KiB
| text/x-rst
|
RstLexer
Jonathan Frederic
|
r21584 | .. _kernel_install: | ||
Min RK
|
r21710 | Installing the IPython kernel | ||
============================= | ||||
Jonathan Frederic
|
r21584 | |||
Thomas Kluyver
|
r21968 | .. seealso:: | ||
:ref:`Installing Jupyter <jupyter:install>` | ||||
The IPython kernel is the Python execution backend for Jupyter. | ||||
Thomas Kluyver
|
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
|
r21710 | |||
Thomas Kluyver
|
r21968 | Kernels for Python 2 and 3 | ||
-------------------------- | ||||
If you're running Jupyter on Python 3, you can set up a Python 2 kernel like this:: | ||||
python2 -m pip install ipykernel | ||||
python2 -m ipykernel install --user | ||||
Jonathan Frederic
|
r21584 | |||
Thomas Kluyver
|
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
|
r21878 | python -m ipykernel install --user | ||
Min RK
|
r21710 | |||
Thomas Kluyver
|
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
|
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
|
r21710 | .. _multiple_kernel_install: | ||
Thomas Kluyver
|
r21968 | Kernels for different environments | ||
---------------------------------- | ||||
Min RK
|
r21710 | |||
Thomas Kluyver
|
r21968 | If you want to have multiple IPython kernels for different virtualenvs or conda environments, | ||
Thomas Kluyver
|
r21971 | you will need to specify unique names for the kernelspecs. | ||
For example, using conda environments: | ||||
Min RK
|
r21710 | |||
.. sourcecode:: bash | ||||
source activate myenv | ||||
Thomas Kluyver
|
r21968 | python -m ipykernel install --user --name myenv --display-name "Python (myenv)" | ||
Min RK
|
r21710 | source activate other-env | ||
Thomas Kluyver
|
r21968 | python -m ipykernel install --user --name other-env --display-name "Python (other-env)" | ||
Min RK
|
r21710 | |||
Thomas Kluyver
|
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. | ||||