Skip to article frontmatterSkip to article content

Running napari in the Cloud

If you can’t install napari and the Jupyter notebook application locally, or if you prefer using a cloud instance of Jupyter to execute and interact with the workshop notebooks, you have two options for running everything in the cloud.

If you are attending SciPy 2025 or have access to a Nebari JupyterHub instance, this is the recommended cloud option for the best performance.

Getting Started with Nebari

Log into the SciPy 2025 Nebari instance following the instructions provided by the organizers.

Once logged in to Nebari, click on the JupyterLab card to open the JupyterLab interface. You will be prompted to select an instance type. Please select the instance labeled Medium Instance (MyST); we will not be leveraging GPU acceleration.

Open a Desktop Tab

Once the JupyterLab interface is open, you should see the typical Launcher tab with a number of tiles, e.g. for creating a new notebook, accessing the terminal, etc. Look for the tile labeled “Desktop”:

Nebari JupyterLab Launcher tab with Desktop tile indicated in red

Click on the “Desktop” tile, which will open a new browser tab with a remote desktop interface to a basic Linux desktop.

Linux desktop in Nebari JupyterHub

By moving your mouse pointer inside this desktop interface, you should be able to interact with it. We will use this browser tab and desktop within it to host the napari GUI window spawned by the Jupyter notebook cells used throughout this workshop.

Now that our desktop is set up, we can proceed to running code!

Access Workshop Materials

To access the workshop materials, you can select the workshop repository in the Tutorials section of the JupyterLab Launcher “Create custom image visualization and analysis tools with napari”.

Alternately, you can use the Git integration in the left-most sidebar and click the “Clone a Repository” button.

Nebari JupyterHub Git integration

For the repository address, enter the following URL:

https://github.com/napari/napari-workshops

Once you have the materials cloned, you should see a directory named napari-workshops in the file browser tab, which can be accessed by the top-most button, the Folder icon, in the left-most sidebar. You can navigate to the workshop folders to find all the workshop materials.

After running any cell which opens the napari viewer from the Jupyter notebook, you should now see the napari GUI window in the Desktop tab on your browser!

Creating a Notebook from Scratch

If you want to start from scratch with an empty notebook, then you need to ensure that you execute the following code cell in your notebook to enable napari to display its GUI window in the Desktop tab:

import os
os.environ['DISPLAY'] = ':1.0'

You will need to run this cell in every new notebook you create!

Option 2: Binder (Free, but limited performance)

If you don’t have access to a Nebari instance, you can use mybinder.org to run the workshop materials in the cloud.

Open a Notebook in Binder

To open a notebook in Binder, click on the rocketship badge at the top of a notebook and click on “Binder”.

Binder badge shown in a notebook

This will open the notebook in Markdown format, but it will not be runnable. Further, because napari is a desktop application, we need a “Desktop” tab to see the napari GUI interface. To do this, close the Markdown notebook to return to the Jupyter launcher tab.

Open Desktop Tab

In the Jupyter launcher tab, click on the “Desktop” tile (marked with D).

Desktop tab button in Jupyter launcher tab

After this, you should see a new tab open up in your browser window called “Jupyter Remote Desktop Proxy”, with a basic Linux desktop interface.

Desktop interface shown in browser tab

By moving your mouse pointer inside this desktop interface, you should be able to interact with it. We will use it to host the napari GUI window.

Run Notebook Cells

Now that our desktop is set up, we can proceed to running each of the cells in the notebook. You can access them from the file browser on the left side.


After running any cell which opens the napari viewer from the Jupyter notebook, you should now see the napari GUI window in the Desktop tab on your browser.

### Interact with the Notebooks!

You should now be able to interact with the notebooks, by executing all cells and observing the results in the napari GUI window. You can also edit the code cells to experiment with different napari concepts and its API. You can save a snapshot of the viewer status to the notebook using the `nbscreenshot` function.

## Troubleshooting Cloud Setups

### napari window not appearing

If the napari window doesn't appear in your Desktop tab:

1. Make sure you ran the setup cell at the beginning of the notebook
2. Verify the Desktop tab is open and active
3. Try clicking in the Desktop tab to ensure it has focus
4. If using Binder, try restarting the kernel and running cells again

### Performance issues

Cloud environments may have limited resources:

- 3D rendering will be slower than on a local machine
- Large datasets may cause memory issues
- Consider working with smaller image crops for better performance

### Session timeouts

Both Nebari and Binder sessions will timeout after inactivity:

- Save your work frequently
- Be aware that unsaved changes will be lost
- You may need to restart your session and re-run cells