Jupyter
Jump to navigation
Jump to search
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