Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install multiple ipython 3.0 kernels (python 2.7, python 3.4, etc...) with anaconda under linux?

Ipython 3.0 (Jupyter) allows to choose which kernel (python 2.7, python 3.4, etc...) to use when creating a new ipython notebook. How can I install multiple ipython notebook kernels under Continuum Anaconda?

like image 507
ehyG Avatar asked Mar 18 '15 09:03

ehyG


People also ask

Can you use multiple kernels within the same Jupyter Notebook?

SoS Notebook is an extension to Jupyter Notebook that allows the use of multiple kernels in one notebook. More importantly, it allows the exchange of data among subkernels so that you can, for example, preprocess data using Bash, analyze the processed data in Python, and plot the results in R.

Does IPython come with anaconda?

IPython is included by default in Anaconda distribution of Python. It can be downloaded from Anaconda's download page www.anaconda.com/download/ Binaries for all major OS (Windows, MacOS and Linux) and architecture (32 bit and 64 bit) are available on this link.

What is the difference between Python 3 and Python 3 Ipykernel?

Python 3 (ipykernel) is the same as the previous Python 3 kernel - it is just a clarification in the label which was added some time ago to let users recognise that the kenel component they rely on is named ipykernel and because there are other kernels that support Python (like xeus-python).


2 Answers

You'll want to make separate conda environments for Python 2 and 3 (see info elsewhere on how to do this), with IPython installed in both of them. Then, in each environment, run:

ipython kernelspec install-self

This registers that kernel so IPython can see it from outside the environment.

If you want more kernelspecs for different environments, look at the files in ~/.ipython/kernels to see how to describe them.

like image 192
Thomas K Avatar answered Sep 28 '22 07:09

Thomas K


install-self is being deprecated: https://github.com/jupyter/jupyter/issues/23

install-self
    [DEPRECATED] Install the IPython kernel spec directory for this Python.

Try

python -m ipykernel install --user --display-name "Python (current_env)"
source activate myenv
python -m ipykernel install --user --name myenv --display-name "Python (myenv)"

instead.

Reference: http://ipython.readthedocs.org/en/stable/install/kernel_install.html

like image 21
Ferro Fang Avatar answered Sep 28 '22 07:09

Ferro Fang