10. Jupyter¶
There are currently two options for Jupyter that are relevant here: the “classic” Jupyter notebook interface, and JupyterLab, the next-generation user interface for the Jupyter Project. Jupyterlab has a modular structure, where you can open several notebooks or files (e.g. HTML, Text, Markdowns etc) as tabs in the same window, and basically offers more of an IDE-like experience.
JupyterLab is fast evolving, and will likely replace Jupyter sooner than later.
We suggest installing both, the classic Jupyter Notebook and Jupyter Lab, as there are certain extensions in the former, such as the nifty RISE extension, that are not yet compatible with the latter.
10.1. Installing¶
Please see project Jupyter’s instructions for installation, which covers both Jupyter variants.
Basically,
If you already have Python 3, follow the following instructions for your particular OS from the above webpage. We will use Python 3 henceforth.
If you are a new Python user, or just want to reinstall Python (say, to move from Python 2 to 3) you can install Python+Jupyter using Anaconda, by downloading Anaconda’s latest Python 3 version.
10.1.1. Windows¶
Your best option is to download and install Anaconda, which includes Python and Jupyter Notebook (among other useful pckages and utilities).
10.1.2. Mac¶
Your best option is to download and install Anaconda, which includes Python and Jupyter Notebook (among other useful pckages and utilities).
10.2. Language Kernels¶
The Jupyter notebook can support almost 100 programming languages (and counting). We will describe the installation of two (IPython and R) because these are likely to be used most commonly across courses.
10.2.1. The IPython kernel¶
The default kernel you will have is IPython (with Python 3 or 2) – the core Jupyter kernel. Click on the kernel menu item at the top of your notebook to check.
If you upgraded to Python 3 from 2 after installing Jupyter, you will need to reinstall Jupyter using pip:
$ python3 -m pip install jupyter
You will then need to relaunch Jupyter. You should see the Python 3 kernel. If you want both Python 2 and 3 kernels, see this.
10.2.2. The R kernel¶
First have a quick look at the Jupyter kernel documentation .
Now, go to the IRKernel github, and follow the instructions for installing using the devtools package in R (This package will also soon be installable through CRAN).
On Ubuntu 20.04, If you run into errors while installing the devtools package through R, very likely you might need to install the curl package using sudo apt install in a terminal first (read the error messages you get in R).
After installing the R kernel, relaunch Jupyter as you did above, and then check your kernels in the drop-down Jupyter nb menu – you should now have both Python and R.
10.3. Adding extensions¶
You can add some useful additional functionalities to your Jupyter notebook interface using (the unofficial) extensions. The list of extensions and further instructions for installation can be found here. You will also probably want to install the extensions “configurator”. This package will add useful functionalities like \(\LaTeX\) environments and TOCs.
Footnotes
- 1
To use these installation instructions for Chrome OS you first need to set up Linux on your Chromebook.