Jupyter and IPython¶
Consider NCAR's JupyterHub instance first!!
This page describes an older, manual approach for launching Jupyter on NCAR resources, prior to the deployment of our hosted JupyterHub instance.
Still. this approach is valid and may be useful in circumstances where the hosted JupyterHub is under maintenane.
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. Jupyter supports many alternative kernels, also known as language interpreters. See details below.
The instructions below describe how to start the browser-based JupyterLab, the IPython shell, and Jupyter QtConsole on the NCAR HPC systems.
For additional information, see Jupyter documentation.
Starting JupyterLab¶
-
Start an interactive job using the
qinteractive @casper
command. (Alternative: Start the job on Derecho usingqinteractive @derecho
. Keep in mind that each CPU or GPU Derecho node has less memory than each CPU or GPU Casper node) -
Load the
ncarenv
andconda
modules. -
Activate the NCAR Python Library via
conda activate npl
or any other environment withjupyterlab
andipython
installed. -
Run the
start-jupyter
command.
The output includes instructions like those shown in the image 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.
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.
Related links¶
-
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
Starting IPython shell¶
-
Start an interactive job using the
qinteractive @casper
command. (Alternative: Start the job on Derecho usingqinteractive @derecho
. Keep in mind that each CPU or GPU Derecho node has less memory than each CPU or GPU Casper node) -
Load the
ncarenv
andconda
modules. -
Activate the NCAR Python Library via
conda activate npl
or any other environment withipython
installed. -
Run the
ipython
command to start the shell.
Starting Jupyter QtConsole¶
-
Log in with X tunneling (using the ssh
-X
option). -
Start an interactive job using the
qinteractive @casper
command. (Alternative: Start the job on Derecho usingqinteractive @derecho
. Keep in mind that each CPU or GPU Derecho node has less memory than each CPU or GPU Casper node) -
Load the
ncarenv
andconda
modules. -
Activate the NCAR Python Library via
conda activate npl
or any other environment withjupyterlab
installed. -
Run the
jupyter qtconsole
command to start the console.
Using alternative language kernels¶
Jupyter supports multiple language interpreters (known as "kernels"). The Python interpreter is loaded by default as the language kernel when using Jupyter, but you can specify use of another kernel when invoking a particular command. To see a list of installed language kernels, run this command:
To use a kernel, specify it by name when invoking a command. For example, to use the R 4.3.0 interpreter on Casper in the Jupyter QtConsole, enter the following:
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 the NCAR Research Computing help desk to have it added in the system library.