Jupyter and IPython

IPython shell | Jupyter QtConsole | Jupyter Notebook

The Jupyter package is designed to facilitate interactive computing, especially for code editing, mathematical expressions, plots, code/data visualization, and parallel computing. The IPython kernel is included in the package.

The instructions below describe how to start the IPython shell, the Jupyter QtConsole, and the browser-based Jupyter Notebook on systems that CISL manages. For additional documentation, see https://jupyter.org/.

Starting IPython shell

Cheyenne users:

  • Start an interactive job using the qinteractive command.
  • Load the python and jupyter modules.
  • Run the ipython command to start the shell.
IPython shell
IPython shell - Click to enlarge.

Starting Jupyter QtConsole

Cheyenne users:

  • Ensure that your work meets the guidelines for interactive use of Cheyenne's login nodes. QtConsole does not work in interactive jobs on the compute nodes.
  • Log in with X tunneling (using the ssh -X option).
  • Load the python, pyside and jupyter modules.
  • Run the jupyter qtconsole command to start the console.
Jupyter Notebook instructions
Jupyter QtConsole- Click to enlarge.

Using alternative language kernels with QtConsole

Jupyter supports multiple language interpreters (known as "kernels"). The Python interpreter is loaded by default as the language kernel for Jupyter commands, but you can specify use of another kernel when invoking a particular command. To see a list of installed language kernels, run this command:

jupyter kernelspec list

To use a kernel, specify it by name when invoking a command. For example, to use the R 3.4.0 interpreter on Cheyenne in the Jupyter QtConsole, enter the following:

jupyter qtconsole --kernel=r-3.4

The console will load with the R command line interpreter active.

If you need a language kernel that has not been installed, you can install it yourself in your local directory or contact cislhelp@ucar.edu to have it added in the system library.

Starting Jupyter Notebook

Cheyenne users:

  • Start an interactive job using the qinteractive command.
  • Load the python and jupyter modules.
  • Run the start-notebook command.

The output includes instructions like those just below. Including the -N after the ssh command establishes the tunneling that allows you to use Jupyter Notebook in your local browser. It also prevents you from actually opening a second ssh session. If you prefer to have a second session open, omit the -N. When you close that session, you will be closing your browser connection to Jupyter Notebook.

Jupyter Notebook instructions
Starting Jupyter Notebook - Click to enlarge.

On your local computer, run the ssh command as instructed.

After you log in with your YubiKey or CRYPTOCard authentication token, the session will appear to hang. At that point, start http://localhost:nnnn in your browser. (The port numbers may be different from those in the output example above.)

Jupyter Notebook will request a password or "token," which is a long string as shown in the output above, that you can copy and paste from your terminal.

Your browser will open the Jupyter Notebook web interface after you log in with the token.

Jupyter Notebook web interface
Jupyter Notebook web interface - Click to enlarge.

Related links

A gallery of interesting Jupyter Notebooks

Notebook: Extract NECOFS water levels using NetCDF4-Python and analyze/visualize with Pandas

Notebook: Access data from the NECOFS (New England Coastal Ocean Forecast System) via OPeNDAP

Notebook: Exploring Climate Data: Past and Future