Manage Jupyter Notebooks

This guide describes how to manage Jupyter Notebooks within your Data Science Stack (DSS) environment.

All actions can be performed using the DSS Command Line Interface (CLI).

Create a notebook

You can create a Jupyter Notebook using the DSS CLI. This notebook includes different packages and toolkits depending on the image used to create it.

  1. Select an image:

Before creating a notebook, you need to select an image that includes the packages and toolkits you need. To see a list of recommended images and their aliases, do:

dss create --help

The output includes a list of recommended images and their aliases. For example, this guide uses the image kubeflownotebookswg/jupyter-scipy:v1.8.0

  1. Create the notebook:

Create a new notebook as follows:

dss create my-notebook --image kubeflownotebookswg/jupyter-scipy:v1.8.0

This command starts a notebook server with the selected image. You should expect an output like this:

Executing create command
Waiting for deployment test-notebook in namespace dss to be ready...
Deployment test-notebook in namespace dss is ready
Success: Notebook test-notebook created successfully.
Access the notebook at http://10.152.183.42:80.

Create an NVIDIA GPU-enabled notebook

You can create an NVIDIA GPU-enabled Jupyter Notebook containing CUDA runtimes and Machine Learning (ML) frameworks, and access its JupyterLab server.

Note

To launch an NVIDIA GPU-enabled notebook, you must first install the NVIDIA Operator and verify DSS can detect the GPU. See Enable NVIDIA GPUs for more details.

To see the list of available CUDA images, run:

dss create --help | grep cuda

You should see an output similar to this:

- pytorch-cuda = kubeflownotebookswg/jupyter-pytorch-cuda-full:v1.8.0
- tensorflow-cuda = kubeflownotebookswg/jupyter-tensorflow-cuda-full:v1.8.0

Select one of them and create a notebook as follows:

dss create my-notebook --image=tensorflow-cuda

You can confirm your GPU is detected and usable by running the following within your notebook:

import tensorflow as tf

tf.config.list_physical_devices('GPU')

Create an Intel GPU-enabled notebook

You can create an Intel GPU-enabled Jupyter Notebook with Intel Extension for PyTorch (IPEX) or Intel Extension for TensorFlow (ITEX).

Note

To launch an Intel GPU-enabled notebook, you must first Enable Intel GPUs.

To see the list of available Intel images, run:

dss create --help | grep intel

You should see an output similar to this:

- pytorch-intel= intel/intel-extension-for-pytorch:2.1.20-xpu-idp-jupyter
- tensorflow-intel = intel/intel-extension-for-tensorflow:2.15.0-xpu-idp-jupyter

Select one of them and create a notebook as follows:

dss create my-itex-notebook --image=tensorflow-intel

You can confirm your Intel GPU is detected and usable by running the following within your notebook:

import tensorflow as tf

tf.config.experimental.list_physical_devices()

List created notebooks

You can check the current state of all notebooks within your DSS environment. To view the full list, run:

dss list

This command displays each notebook name along with its associated image, state, and URL if applicable.

Remove a notebook

You can remove a Jupyter Notebook using the DSS CLI. It is a non-blocking process, meaning you can continue other work while the deletion completes.

  1. Remove the notebook:

To delete the notebook, use the dss remove command followed by the name of the notebook, my-notebook in this example:

dss remove my-notebook

You should expect an output like this:

Removing the notebook my-notebook. Check `dss list` for the status of the notebook.

Start a notebook

You can start a notebook using the DSS CLI. This enables you to resume your work without needing to configure a new notebook.

dss start my-notebook

Stop a notebook

You can stop a notebook using the DSS CLI. Stopping a notebook frees up resources and ensures data safety when not actively working on it.

dss stop my-notebook

Access a notebook

You can access a notebook User Interface (UI) using the DSS CLI. Accessing the UI enables you to interact directly with your notebook, run code, and visualise data. This is done through a web browser by navigating to the URL associated with your active notebook.

  1. Find the notebook URL:

To find the URL of your notebook, first list all the notebooks:

dss list

Look for your notebook in the output, and specifically check the URL column.

  1. Access the Notebook UI:

Once you know the URL, open a web browser and enter the URL into the address bar.

Get notebook logs

You can retrieve logs for a Jupyter Notebook using the DSS CLI. Retrieving logs can help you troubleshoot issues, monitor notebook activities, or verify actions taken in the notebook.

dss logs my-notebook

See also

  • To learn how to manage your DSS environment, check Manage DSS.

  • If you are interested in managing MLflow within your DSS environment, see Manage MLflow.