Jupyter notebooks

(Julia, Python, R ...)

a brief introduction

Overview


  • history + purpose
  • installation + basic use
  • resources + tutorials
Jupyter logo

History + Purpose

Looking backwards...

Notebooks are not a new concept

Very Brief History

  • IPython, 2001, Fernando PĂ©rez
    • interactive python
  • IPython kernel (2010)
  • IPython Notebook (prototype 2010/11, initial dev. 2005/7)
  • Jupyter Project established 2014
    • multi-language, beyond Julia, Python and R
    • non-profit, open-source, free to use
    • Jupyter Notebook App (server-client app)
    • Jupyter Hub (serves groups of users)
    • Next generation: Jupyter Lab

Purpose

text, calculation and graphics together + GUI (+ presentation-mode)

  • a list of cells
  • cells contain text or executable code
  • reproducible workflows + documentation
  • results can be saved with code that generated them
  • runs in your browser
  • stored in version-control-friendly JSON (.ipynb)

Structure

.ipynb document + kernel

Documents

code (input/output)

  • rich, interactive outputs (e.g. charts)
  • exceptions

text (docs/comments)

  • markdown
  • LaTeX equations

slide generation

magics (mini command language)

  • % (line magics)
  • %% (cell magics)
  • e.g. timeit, writefile ...

shell commands

  • use ! or !!
  • e.g. !ls to list

Kernels

Each kernel is a separate process running your code in different programming languages and environments.

Persist over time and between cells, meaning for the entire document.

List of Jupyter Kernels here

Installation

  • Jupyter runs many programming languages, but requires Python.
  • Recommended: the python virtual environment, package and dependency manager conda
    1. install Anaconda or miniconda (simplified version)
    2. start and check installation
    3. manage environments including different versions of python
    4. search and find different versions of packages
    5. create an environment with Jupyter etc.
    6. activate the environment
    7. Go!

(Tutorial: Getting Started with conda)

  • Alternative: use Python's package manager, pip

Running a Notebook

Start the notebook server:

jupyter notebook

The Jupyter Notebook App will open automatically in your browser.

Default: http://localhost:8888

[Docs]

Take a look ...

Running JupyterLab

Start the lab server:

jupyter lab

JupyterLab will open automatically in your browser.

Default: http://localhost:8888/lab

Because JupyterLab is a server extension of the classic notebook server -- you can also just visit the /lab URL.

Further Tutorials and Resources

Thank you for your attention!

E-Mail: hannah.augustin@sbg.ac.at

GitHub: @augustinh22

Website: http://hannahaugustin.at

Slides: http://slides.hannahaugustin.at/maptime/Jupyter_intro/