# Running a Jupyter Notebook

> Source: https://parallelworks.com/docs/run/sessions/interactive-sessions/jupyter-notebook

# Running a Jupyter Notebook

This page focuses on the Jupyter workflow, which enables you to run and manage Jupyter Notebooks. 

After [adding the Jupyter Notebook Server workflow](/docs/run/workflows/adding-workflows), navigate to the **Workflows** page and click its name. If you've [favorited it](/docs/run/workflows/adding-workflows#favoriting-workflows), you can also click its card from the **Favorite Workflows** widget on your **Dashboard**.

![Screenshot of the user clicking the Jupyter Notebook Server workflow.](/content-images/docs/run/sessions/interactive-sessions/jupyter-notebook/click-jupyter-workflow.png)

You’ll be taken to the workflow’s configuration page. 

Navigate to the **Jupyter Server Host** section. The settings here depend on where you're running the workflow: in your user container, on a controller node, or on a compute node.

:::info About Resources
Running an interactive session on a controller or compute node requires a running resource. If you plan to run an interactive session in your ACTIVATE user workspace, you do not have to have a resource running. 
:::

Use the **Service Host** dropdown menu to choose where the workflow will be hosted. Select `User Workspace`. 

Use the **Select Controller...** dropdown menu to choose how the job will be submitted. Select `PW USER CONTAINER`.

![Screenshot of the user selecting the service host and controller.](/content-images/docs/run/sessions/interactive-sessions/jupyter-notebook/select-host-controller-jupyter-container.png)

Click **Execute**.

![Screenshot of the user clicking Execute.](/content-images/docs/run/sessions/interactive-sessions/jupyter-notebook/click-execute-jupyter-container.png)

Use the **Service Host** dropdown menu to choose which cluster will host the workflow. We selected `Demo Cluster`.

Use the **Select…** dropdown menu to choose how the job will be submitted. Select `Controller`.

![Screenshot of the user selecting the service host and controller.](/content-images/docs/run/sessions/interactive-sessions/jupyter-notebook/select-host-controller-jupyter-controller.png)

Click **Execute**.

![Screenshot of the user clicking Execute.](/content-images/docs/run/sessions/interactive-sessions/jupyter-notebook/click-execute-jupyter-controller.png)

Use the **Service Host** dropdown menu to choose which cluster will host the workflow. We selected `Demo Cluster`.

Use the **Select…** dropdown menu to choose how the job will be submitted. We selected `SLURM Partition`.

Optionally, you can use the next field to name a specific partition to run the workflow. This field will be named either **SLURM Partiton** or **PBS Queue**. We used `partition1`.

Optionally, use the **Schedular Directives** field to enter additional parameters for your partition. We entered `--gpus-per-node=1`.

![Screenshot of the user selecting the service host and controller.](/content-images/docs/run/sessions/interactive-sessions/jupyter-notebook/select-host-controller-jupyter-compute.png)

Click **Execute**.

![Screenshot of the user clicking Execute.](/content-images/docs/run/sessions/interactive-sessions/jupyter-notebook/click-execute-jupyter-compute.png)

You’ll be taken to your workflow’s configuration page. In the **Workflow Monitor** module, click the **View**  icon.

![Screenshot of the user clicking the View icon.](/content-images/docs/run/sessions/interactive-sessions/jupyter-notebook/click-view-jupyter.png)

You may see a page with the message *Validating URL* before the page loads. If you see the message for more than 30 seconds, you can refresh the page.

On the Jupyter page, click the `untitled.ipynb` file. 

![Screenshot of the user clicking the Jupyter file.](/content-images/docs/run/sessions/interactive-sessions/jupyter-notebook/click-jupyter-notebook.png)

Your Jupyter Notebook will open in a new tab. You can browse files, create a new Notebook, or double-click on an existing Notebook within your `/pw` file system. 

![j_notebook_10_nov23.png](/content-images/docs/run/sessions/interactive-sessions/jupyter-notebook/j_notebook_10_nov23.png)

Enter `!hostname` to confirm where the Notebook is running. The `!` tells Jupyter to execute the `hostname` command in the shell of the underlying operating system. 

Click  **Run**. 

![j_notebook_11_nov23.png](/content-images/docs/run/sessions/interactive-sessions/jupyter-notebook/j_notebook_11_nov23.png)

The Notebook will generate a new line with the output `pw_user_<your_user_id>`, which is the same hostname displayed in your ACTIVATE IDE terminal.

![j_notebook_12_nov23.png](/content-images/docs/run/sessions/interactive-sessions/jupyter-notebook/j_notebook_12_nov23.png)

Now you can use the Jupyter Notebook for anything. Please be sure to end the workflow when you're finished by navigating to the **Workflows** page and clicking the **Cancel**  icon.

![Screenshot of the user clicking the Cancel icon.](/content-images/docs/run/sessions/interactive-sessions/jupyter-notebook/click-cancel-jupyter.png)

:::info About Kernels
You can connect a running Jupyter Notebook to a kernel (i.e., execution engine) in a different Conda environment. To see your available kernels, click **Kernel > Change kernel** in the Jupyter banner. 
:::
