Jupyter and IPython

JupyterLab | IPython shell | Jupyter QtConsole

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 browser-based JupyterLab, the IPython shell, and Jupyter QtConsole on the Cheyenne system and the Casper data analysis and visualization nodes. For additional information, see the Jupyter documentation.


Starting JupyterLab

  • Start an interactive job using the qinteractive command. (Alternative: Start the job on Casper using execdav if it requires GPUs or more memory than is available on Cheyenne.)
  • Load the python module.
  • Run the ncar_pylib command to load the NCAR Package Library virtual environment.
  • Run the start-jupyter command. (The older Notebook interface is still available using 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 JupyterLab 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 JupyterLab.

JupyterLab instructions
Starting JupyterLab - Click to enlarge.

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

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

JupyterLab 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 JupyterLab web interface after you log in with the token.

JupyterLab example
JupyterLab 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


Starting IPython shell

  • Start an interactive job using the qinteractive command. (Alternative: Start the job on Casper using execdav if it requires GPUs or more memory than is available on Cheyenne.)
  • Load the python module.
  • Run the ncar_pylib command to load the NCAR Package Library virtual environment.
  • Run the ipython command to start the shell.
IPython shell
IPython shell - Click to enlarge.

Starting Jupyter QtConsole

  • Log in with X tunneling (using the ssh -X option).
  • Start an interactive job using the qinteractive command. (Alternative: Start the job on Casper using execdav if it requires GPUs or more memory than is available on Cheyenne.)
  • Load the python module.
  • Run the ncar_pylib command to load the NCAR Package Library virtual environment.
  • Run the jupyter qtconsole command to start the console.
Jupyter QtConsole terminal
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.