8/25/2017 - 9:59 AM

Note Series: Jupyter notebook

Note Series: Jupyter notebook

# A systemd script for running a Jupyter notebook server.
# After Ubuntu 16.04, Systemd becomes the default. 
# It is simpler than https://gist.github.com/Doowon/38910829898a6624ce4ed554f082c4dd

Description=Jupyter Notebook

ExecStart=/home/phil/Enthought/Canopy_64bit/User/bin/jupyter-notebook --config=/home/phil/.jupyter/jupyter_notebook_config.py


Setup of Jupyter notebook

  1. Installing Octave kernel for jupyter

# install octave on Fedora
dnf install octave

# install octave on RH7
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo yum localinstall epel-release-latest-7.noarch.rpm
sudo yum install epel-release
sudo yum install octave

# install preqisuite
dnf install redhat-rpm-config
dnf install python-devel

# install actual kernel (root required)
pip install octave_kernel
python -m octave_kernel.install
  1. Install R for jupyter

# install preqisuite
dnf install R-core
dnf install R-devel
dnf install openssl-devel
dnf install libcurl libcurl-devel

# install R kernel (to executed on R terminal)
IRkernel::installspec()  # to register the kernel in the current R installation
IRkernel::installspec(name = 'ir33', displayname = 'R 3.3')
  1. Python

# If you’re running Jupyter on Python 3, set up a Python 2 kernel:
sudo -H pip install --upgrade pip # upgrade pip if required
python2 -m pip install ipykernel
python2 -m ipykernel install --user

Jupyter command

jupyter-notebook --config=$HOME/.jupyter/jupyter_notebook_config.py
jupyter notebook stop
ipython kernelspec list     # list all kernels for jupyter
jupyter kernelspec list     # list all kernels for jupyter
jupyter kernelspec remove matlab    # remove jupyter kernel

# Notebooks directory
c.NotebookApp.notebook_dir = 'your path'
# IPs can access to the serve
c.NotebookApp.ip = '*'

# Setup password for jupyter
from IPython.lib import passwd
password = passwd("Jupyter")
# Jupyter kernel location

pgrep string # process id


Commands to check version of each kernel's core from their own command line interface

For python

>>> import sys
>>> print(sys.version)

For scala

scala> util.Properties.versionString

For julia

julia> VERSION

For R

> version

For octave

octave:1> OCTAVE_VERSION()

For bash

$ bash --version