Jupyter: Difference between revisions

From miki
Jump to navigation Jump to search
(Created page with "The [http://jupyter.org/ Jupyther] Notebook is a web application that allows you to create and share documents that contain live code, equations, visualizations and explanator...")
 
 
(5 intermediate revisions by the same user not shown)
Line 1: Line 1:
The [http://jupyter.org/ Jupyther] Notebook is a web application that allows you to create and share documents that contain live code, equations, visualizations and explanatory text.
The [http://jupyter.org/ Jupyter] Notebook is a web application that allows you to create and share documents that contain live code, equations, visualizations and explanatory text.

== References ==
* [http://jupyter.org/ Jupyter]
* [https://github.com/ipython/ipython/wiki/IPython-kernels-for-other-languages IPython/Jupyter kernels]

Examples are available on the Jupyter viewer:
* [http://nbviewer.jupyter.org/ Jupyter Notebook Viewer]

Jupyter is available as standard Python packages, but also distributed via Anaconda:
* [https://www.continuum.io/ Anaconda]
:Modern open source analytics platform powered by Python


== Install ==
== Install ==
Line 10: Line 21:
<source lang=bash>
<source lang=bash>
jupyter notebook
jupyter notebook
</source>

=== Sagemath kernel ===
We can register ''sage'' to have it available as a kernel in Jupyter. Here the recipe I followed using
* '''Ubuntu 14.04 LTS'''
* '''Jupyter 4.10''' &mdash; installed locally in user home {{file|~/.ipython}} / {{file|~/.jupyter}}.
* '''Sage 6.10''' &mdash; installed in {{file|/sage}}.

First starts sage and register the kernel using '''SageKernelSpec''' [http://doc.sagemath.org/html/en/reference/repl/sage/repl/ipython_kernel/install.html]
<source lang=bash>
/sage/sage
</source>
<source lang=python>
sage: from sage.repl.ipython_kernel.install import SageKernelSpec
sage: spec = SageKernelSpec()
sage: spec.update() # not tested
</source>
* This does nothing, but apparently registration requires a file named {{file|kernel.json}} [http://ask.sagemath.org/question/30163/jupyter-ipython-notebook-kernel-math-display/]. We find this file in {{file|/sage/local/share/jupyter/kernels/sagemath/}}
<source lang=bash>
$ find /sage -name kernel.json
/sage/local/share/jupyter/kernels/sagemath/kernel.json
</source>
:In the same tree we also find '''jsmol''' and '''mathjax''' extensions.
* From iPython/Jupyter documentation [https://ipython.org/ipython-doc/3/development/kernels.html], we understand we must add the links ourselves in user's home:
<source lang=bash>
mkdir ~/.ipython/kernels
ln -sf /sage/local/share/jupyter/kernels/sagemath ~/.ipython/kernels
ln -sf /sage/local/share/jsmol ~/.ipython/nbextensions
ln -sf /sage/local/share/mathjax ~/.ipython/nbextensions
</source>
From now on sage is available in Jupyter notebook. Note that we don't need to start sage separately.

'''Update''' &mdash; More information on [http://jupyter.readthedocs.org/en/latest/migrating.html ipython-jupyter migration] page. Can we use the following instead:
<source lang=bash>
jupyter nbextension install [--user] EXTENSION
jupyter kernelspec install [--user] KERNEL
</source>
</source>

Latest revision as of 08:30, 10 February 2016

The Jupyter Notebook is a web application that allows you to create and share documents that contain live code, equations, visualizations and explanatory text.

References

Examples are available on the Jupyter viewer:

Jupyter is available as standard Python packages, but also distributed via Anaconda:

Modern open source analytics platform powered by Python

Install

First install Anaconda:

bash Anaconda2-2.5.0-Linux-x86_64.sh

To start the server:

jupyter notebook

Sagemath kernel

We can register sage to have it available as a kernel in Jupyter. Here the recipe I followed using

  • Ubuntu 14.04 LTS
  • Jupyter 4.10 — installed locally in user home ~/.ipython / ~/.jupyter.
  • Sage 6.10 — installed in /sage.

First starts sage and register the kernel using SageKernelSpec [1]

/sage/sage
sage: from sage.repl.ipython_kernel.install import SageKernelSpec
sage: spec = SageKernelSpec()
sage: spec.update()  # not tested
  • This does nothing, but apparently registration requires a file named kernel.json [2]. We find this file in /sage/local/share/jupyter/kernels/sagemath/
$ find /sage -name kernel.json
/sage/local/share/jupyter/kernels/sagemath/kernel.json
In the same tree we also find jsmol and mathjax extensions.
  • From iPython/Jupyter documentation [3], we understand we must add the links ourselves in user's home:
mkdir ~/.ipython/kernels
ln -sf /sage/local/share/jupyter/kernels/sagemath ~/.ipython/kernels
ln -sf /sage/local/share/jsmol                    ~/.ipython/nbextensions
ln -sf /sage/local/share/mathjax                  ~/.ipython/nbextensions

From now on sage is available in Jupyter notebook. Note that we don't need to start sage separately.

Update — More information on ipython-jupyter migration page. Can we use the following instead:

jupyter nbextension install [--user] EXTENSION
jupyter kernelspec install [--user] KERNEL