Chapter 1. Creating and importing notebooks
You can create a blank notebook or import a notebook from a number of different sources.
1.1. Creating a new notebook
You can create a new Jupyter notebook from an existing notebook container image to access its resources and properties. The Notebook server control panel contains a list of available container images that you can run as a single-user notebook server.
Prerequisites
- Ensure that you have logged in to Red Hat OpenShift Data Science.
- Ensure that you have launched your notebook server and logged in to Jupyter.
- The notebook image exists in a registry, image stream, and is accessible.
Procedure
-
Click File
New Notebook. If prompted, select a kernel for your notebook from the list.
If you want to use a kernel, click Select. If you do not want to use a kernel, click No Kernel.
Verification
- Check that the notebook file is visible in the JupyterLab interface.
1.1.1. Notebook images for data scientists
Red Hat OpenShift Data Science contains Jupyter notebook images optimized with industry-leading tools and libraries required for your data science work. To provide a consistent, stable platform for your model development, all notebook images contain the same version of Python. Notebook images available on Red Hat OpenShift Data Science are pre-built and ready for you to use immediately after OpenShift Data Science is installed or upgraded.
Notebook images are supported for a minimum of one year. Major updates to pre-configured notebook images occur approximately every six months. Therefore, two supported notebook images are typically available at any given time. You can use this support period to update your code to use components from the latest available notebook image.
If necessary, you can still access older notebook images from the registry, even if they are no longer supported. You can then add the older notebook images as custom notebook images to cater for your project’s specific requirements.
Red Hat OpenShift Data Science contains the following notebook images that are installed by default:
Image name | Description |
---|---|
CUDA | If you are working with compute-intensive data science models that require GPU support, use the Compute Unified Device Architecture (CUDA) notebook image to gain access to the NVIDIA CUDA Toolkit. Using this toolkit, you can optimize your work using GPU-accelerated libraries and optimization tools. |
Standard Data Science | Use the Standard Data Science notebook image for models that do not require TensorFlow or PyTorch. This image contains commonly used libraries to assist you in developing your machine learning models. |
TensorFlow | TensorFlow is an open source platform for machine learning. With TensorFlow, you can build, train and deploy your machine learning models. TensorFlow contains advanced data visualization features, such as computational graph visualizations. It also allows you to easily monitor and track the progress of your models. |
PyTorch | PyTorch is an open source machine learning library optimized for deep learning. If you are working with computer vision or natural language processing models, use the Pytorch notebook image. |
Minimal Python | If you do not require advanced machine learning features, or additional resources for compute-intensive data science work, you can use the Minimal Python image to develop your models. |
TrustyAI | Use the TrustyAI notebook image to leverage your data science work with model explainability, tracing and accountability, and runtime monitoring. |
1.2. Uploading an existing notebook file from local storage
You can load an existing notebook from local storage into JupyterLab to continue work, or adapt a project for a new use case.
Prerequisites
- Credentials for logging in to Jupyter.
- A launched and running notebook server.
- A notebook file exists in your local storage.
Procedure
- In the File Browser in the left sidebar of the JupyterLab interface, click Upload Files ( ).
Locate and select the notebook file and click Open.
The file is displayed in the File Browser.
Verification
- The notebook file displays in the File Browser in the left sidebar of the JupyterLab interface.
- You can open the notebook file in JupyterLab.
1.3. Uploading an existing notebook file from a Git repository using JupyterLab
You can use the JupyterLab user interface to clone a Git repository into your workspace to continue your work or integrate files from an external project.
Prerequisites
- A launched and running Jupyter server.
- Read access for the Git repository you want to clone.
Procedure
Copy the HTTPS URL for the Git repository.
-
On GitHub, click ⤓ Code
HTTPS and click the Clipboard button. - On GitLab, click Clone and click the Clipboard button under Clone with HTTPS.
-
On GitHub, click ⤓ Code
In the JupyterLab interface, click the Git Clone button ( ).
You can also click Git
Clone a repository in the menu, or click the Git icon ( ) and click the Clone a repository button. The Clone a repo dialog appears.
- Enter the HTTPS URL of the repository that contains your notebook.
- Click CLONE.
- If prompted, enter your username and password for the Git repository.
Verification
- Check that the contents of the repository are visible in the file browser in JupyterLab, or run the ls command in the terminal to verify that the repository is shown as a directory.
1.4. Uploading an existing notebook file from a Git repository using the command line interface
You can use the command line interface to clone a Git repository into your workspace to continue your work or integrate files from an external project.
Prerequisites
- A launched and running Jupyter server.
Procedure
Copy the HTTPS URL for the Git repository.
-
On GitHub, click ⤓ Code
HTTPS and click the Clipboard button. - On GitLab, click Clone and click the Clipboard button under Clone with HTTPS.
-
On GitHub, click ⤓ Code
-
In JupyterLab, click File
New Terminal to open a terminal window. Enter the
git clone
command.git clone <git-clone-URL>
Replace `<git-clone-URL>` with the HTTPS URL, for example:
[1234567890@jupyter-nb-jdoe ~]$ git clone https://github.com/example/myrepo.git Cloning into myrepo... remote: Enumerating objects: 11, done. remote: Counting objects: 100% (11/11), done. remote: Compressing objects: 100% (10/10), done. remote: Total 2821 (delta 1), reused 5 (delta 1), pack-reused 2810 Receiving objects: 100% (2821/2821), 39.17 MiB | 23.89 MiB/s, done. Resolving deltas: 100% (1416/1416), done.
Verification
- Check that the contents of the repository are visible in the file browser in JupyterLab, or run the ls command in the terminal to verify that the repository is shown as a directory.