Jupyter Notebook

Setup and snippets for a smooth jupyter notebook experience
code snippets
jupyter
python

March 2, 2020

Start jupyter notebook on boot

Edit the crontab for your user.

crontab -e

Add the following line.

@reboot source ~/.venv/venv/bin/activate; ~/.venv/venv/bin/jupyter-notebook

Magic Commands

Autoreload imports when file changes were made.

%load_ext autoreload
%autoreload 2

Show matplotlib plots inside the notebook.

import matplotlib.pyplot as plt
%matplotlib inline

Measure excecution time of a cell.

%%time

pip install from jupyter notebook.

import sys
!{sys.executable} -m pip install numpy