# Testing Jupyter Notebooks on RHEL9 mini-cluster

Follow these instructions to test your Jupyter notebooks on the RHEL 9 minicluster during the transition to the new cluster. After maintenance, these instructions will be obsolete and you will be able to use the OOD apps.

## Instructions:

### Step 1. Start a Desktop session

1. Start a desktop session on Open OnDemand. For a refresher, [follow these instructions](/oscar/connecting-to-oscar/open-ondemand/desktop-app-vnc.md).
2. Open a terminal. This terminal is running on the old RHEL 7. Run this command to start firefox

```bash
 module load firefox/87.0 && firefox &
```

Perform the next step in a different terminal. We will return to this desktop session in Step 3.

### Step 2. Start an interactive job on RHEL 9

1. [Connect to login009](/oscar/sys-changes/lmod-new-module-system.md#accessing-rhel9-minicluster) on a terminal.
2. Start an interactive job with the appropriate amount of resources. For example, to request 4 cores and 16GB of memory for 2 hours, run:

   ```bash
   interact -n 1 -m 16g -t 2:00:00
   ```
3. On the compute node, run these commands:

   ```bash
   unset XDG_RUNTIME_DIR
   module load anaconda
   ipnport=$(shuf -i8000-9999 -n1)
   echo $ipnport
   ipnip=$(hostname -i)
   echo $ipnip
   jupyter-notebook --no-browser --port=$ipnport --ip=$ipnip
   ```

   <div data-gb-custom-block data-tag="hint" data-style="info" class="hint hint-info"><p>Replace jupyter-notebook with jupyter-lab in the last line to use JupyterLab interface</p></div>
4. You will see a lot of text output in the terminal screen. Find the line that looks like

   ```bash
   file:///oscar/home/...........-open.html
   ```
5. Copy that line.

### Step 3. Run Jupyter notebook in the Desktop session

Go back to your Open OnDemand Desktop session from Step 1. Paste the line from the previous step in the address bar on Firefox.

You should see Jupyter notebook displayed inside the browser. While the computations happen on the compute node running RHEL 9, you will see the Jupyter interface on the older OS.

## Testing Virtual Environments:

There are two ways to test any conda or python virtual environments that you may have installed in your personal directories on Oscar.

### - Switch kernel in the Jupyter interface

If your Python or Conda environment has been configured with ipykernel correctly, you will see your environment in the selection list when you try to switch the kernel.

More information on [configuring your environments](/oscar/connecting-to-oscar/open-ondemand/using-python-or-conda-environments-in-the-jupyter-app.md).

### - Activate environment before starting Jupyter notebook

Activate your Python virtual environment or Conda environment before running the `jupyter-notebook` command. If you are using a Python virtual environment, you may not need to run the line `module load anaconda`


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ccv.brown.edu/oscar/sys-changes/testing-jupyter-notebooks-on-rhel9-mini-cluster.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
