/ncar-python-tutorial

Numerical & Scientific Computing with Python Tutorial

Primary LanguageJupyter NotebookCreative Commons Attribution 4.0 InternationalCC-BY-4.0

https://circleci.com/gh/NCAR/ncar-python-tutorial/tree/master

NCAR Python Tutorial


Setup

This tutorial covers the installation and setup of a Python environment on:

  • Cheyenne
  • Casper
  • CGD's Hobart
  • Personal laptop/desktop with a UNIX-variant Operating System

NOTE: For windows users, setup scripts provided in this repository don't work on Windows machines for the time being. You may want to follow the instructions available here.

Step 1: Clone NCAR Python Tutorial Repository

Run the following commmand to clone this repo to your system(e.g. cheyenne, casper, your laptop, etc...):

git clone https://github.com/NCAR/ncar-python-tutorial.git

Step 2: Install Miniconda and Create Environments

  • Change directory to the cloned repository

    cd ncar-python-tutorial
  • Run the configure script:

    ./setup/configure

    This script does the following:

    • Install conda package manager if it is unable to find an existing installation. Otherwise, it will update the base environment
    • Create or Update python-tutorial conda environment.
    • Download data if not on Cheyenne or Casper or Hobart. If on Cheyenne or Casper or Hobart, create soft-links to an existing/local data repository.

NOTE: Be prepared for the script to take up to 15 minutes to complete.

$ ./setup/configure --help
usage: configure [-h] [--clobber] [--download]

Set up tutorial environment.

optional arguments:
  -h, --help      show this help message and exit
  --clobber, -c   Clobber existing environment
  --download, -d  Download tutorial data without setting environment up

Step 3: Close and re-open your current shell

For changes to take effect, close and re-open your current shell.

Step 4: Run the Setup Verification Script

  • Check that conda info runs successfully:

    conda info
  • From the ncar-python-tutorial directory, activate python-tutorial conda environment:

    conda activate python-tutorial
  • Run the setup verification script to confirm that everything is working as expected:

    cd ncar-python-tutorial
    ./setup/check_setup

    This step should print "Everything looks good!".


Launch Jupyter Lab

1. Cheyenne or DAV via JupyterHub (Recommended)

To use the Cheyenne or DAV compute nodes,we recommend using JupyterLab via NCAR's JupyterHub deployment.

Open your preferred browser (Chrome, Firefox, Safari, etc...) on your local machine, and head over to https://jupyterhub.ucar.edu/.

You will need to authenticate with either your yubikey or your DUO mobile app

2. Cheyenne or DAV via SSH Tunneling

In case you are having issues with jupyterhub.ucar.edu, we've provided utility scripts for launching JupyterLab on both Cheyenne and Casper via SSH Tunneling:

conda activate base
./setup/jlab/jlab-ch # on Cheyenne
./setup/jlab/jlab-dav # on Casper

3. Hobart via SSH Tunneling

For those interested in running JupyterLab on CGD's Hobart, you will need to use SSH tunneling script provided in setup/jlab/jlab-hobart

conda activate base
./setup/jlab/jlab-hobart
$ ./setup/jlab/jlab-hobart --help
Usage: launch dask
Possible options are:
 -w,--walltime: walltime [default: 08:00:00]
 -q,--queue: queue [default: medium]
 -d,--directory: notebook directory
 -p,--port: [default: 8888]

4. Personal Laptop

For those interested in running JupyterLab on their local machine, you can simply run the following command, and follow the printed instructions on the console:

conda activate base
jupyter lab