Skip to content

Commit de982d3

Browse files
committed
Refresh Jupyter Notebooks class type
1 parent 6e3bb30 commit de982d3

File tree

1 file changed

+72
-48
lines changed

1 file changed

+72
-48
lines changed

articles/lab-services/class-type-jupyter-notebook.md

Lines changed: 72 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
---
2-
title: Set up a lab to teach data science with Python and Jupyter Notebooks | Microsoft Docs
3-
description: Learn how to set up a lab to teach data science using Python and Jupyter Notebooks.
4-
ms.topic: how-to
5-
ms.date: 01/04/2022
2+
title: Set up a data science lab with Python and Jupyter Notebooks
3+
titleSuffix: Azure Lab Services
4+
description: Learn how to set up a lab VM in Azure Lab Services to teach data science using Python and Jupyter Notebooks.
5+
services: lab-services
66
ms.service: lab-services
7+
author: ntrogh
8+
ms.author: nicktrog
9+
ms.topic: how-to
10+
ms.date: 02/17/2023
711
---
812

913
# Set up a lab to teach data science with Python and Jupyter Notebooks
1014

11-
[!INCLUDE [preview note](./includes/lab-services-new-update-focused-article.md)]
15+
This article outlines how to set up a [template virtual machine (VM)](./classroom-labs-concepts.md#template-virtual-machine) in Azure Lab Services with the tools for teaching students to use Jupyter Notebooks. You also learn how to lab users can connect to notebooks on their virtual machines.
1216

13-
Jupyter Notebooks is an open-source project that lets you easily combine rich text and executable Python source code on a single canvas called a notebook. Running a notebook results in a linear record of inputs and outputs. Those outputs can include text, tables of information, scatter plots, and more.
14-
15-
This article outlines how to set up a template virtual machine (VM) in Azure Lab Services with the tools needed to teach students to use [Jupyter Notebooks](http://jupyter-notebook.readthedocs.io/). We'll also show how students can connect to their notebooks on their virtual machines (VMs).
17+
[Jupyter Notebooks](https://jupyter-notebook.readthedocs.io/) is an open-source project that enables you to easily combine rich text and executable Python source code on a single canvas, known as a notebook. Running a notebook results in a linear record of inputs and outputs. Those outputs can include text, tables of information, scatter plots, and more.
1618

1719
## Lab configuration
1820

@@ -22,42 +24,51 @@ This article outlines how to set up a template virtual machine (VM) in Azure Lab
2224

2325
[!INCLUDE [must have lab plan](./includes/lab-services-class-type-lab-plan.md)]
2426

25-
Enable settings described in the table below for the lab plan. For more information on enabling marketplace images, see [specify Marketplace images available to lab creators](specify-marketplace-images.md).
27+
This lab uses one of the Data Science Virtual Machine Azure Marketplace images as the base VM image. You first need to enable these images in your lab plan. This lets lab creators then select the image as a base image for their lab.
28+
29+
1. Follow these steps to [enable these Azure Marketplace images available to lab creators](specify-marketplace-images.md). Select one of the following Azure Marketplace images, depending on your OS requirements:
2630

27-
| Lab plan setting | Instructions |
28-
| ------------------- | ------------ |
29-
| Marketplace image | Inside your lab account, enable either **Data Science Virtual Machine – Windows Server 2019** or **Data Science Virtual Machine – Ubuntu 18.04** depending on your OS needs. |
31+
- **Data Science Virtual Machine – Windows Server 2019**
32+
- **Data Science Virtual Machine – Ubuntu 18.04**
33+
34+
1. Alternately, create a custom VM image:
3035

31-
This article uses the Data Science virtual machine images available on the Azure Marketplace because they are already configured with Jupyter Notebook. These images, however, also include many other development and modeling tools for data science. If you don't want those extra tools and want a lightweight setup with only Jupyter notebooks, create a custom VM image. For an example, [Installing JupyterHub on Azure](http://tljh.jupyter.org/en/latest/install/azure.html). Once the custom image is created, you can upload it to a compute gallery to use the image inside Azure Lab Services. Learn more about [using compute gallery in Azure Lab Services](how-to-attach-detach-shared-image-gallery.md).
36+
The Data Science VMs images in the Azure Marketplace are already configured with Jupyter Notebooks. These images, however, also include many other development and modeling tools for data science. If you don't want those extra tools and want a lightweight setup with only Jupyter notebooks, create a custom VM image. For an example, [Installing JupyterHub on Azure](http://tljh.jupyter.org/en/latest/install/azure.html).
37+
38+
After you create the custom image, upload the image to a compute gallery to use it with Azure Lab Services. Learn more about [using compute gallery in Azure Lab Services](how-to-attach-detach-shared-image-gallery.md).
3239

3340
### Lab settings
3441

35-
[!INCLUDE [create lab](./includes/lab-services-class-type-lab.md)] Enable your lab settings as described in the following table. For more information about how to enable Azure Marketplace images, see [Specify the Azure Marketplace images available to lab creators](./specify-marketplace-images.md).
42+
1. Create a lab for your lab plan:
43+
44+
[!INCLUDE [create lab](./includes/lab-services-class-type-lab.md)] Specify the following lab settings:
3645

37-
| Lab settings | Value |
38-
| ------------ | ------------------ |
39-
| Virtual machine size | Select **Small** or **Medium** for a basic setup accessing Jupyter Notebooks. Select **Small GPU (Compute)** for compute-intensive and network-intensive applications used in Artificial Intelligence and Deep Learning classes. |
40-
| Virtual machine image | Choose **[Data Science Virtual Machine – Windows Server 2019](https://azuremarketplace.microsoft.com/marketplace/apps/microsoft-dsvm.dsvm-win-2019)** or **[Data Science Virtual Machine – Ubuntu](https://azuremarketplace.microsoft.com/en-us/marketplace/apps?search=Data%20science%20Virtual%20machine&page=1&filters=microsoft%3Blinux)** depending on your OS needs. |
41-
| Template virtual machine settings | Select **Use virtual machine without customization.**.
46+
| Lab settings | Value |
47+
| ------------ | ------------------ |
48+
| Virtual machine size | Select **Small** or **Medium** for a basic setup accessing Jupyter Notebooks. Select **Small GPU (Compute)** for compute-intensive and network-intensive applications used in Artificial Intelligence and Deep Learning classes. |
49+
| Virtual machine image | Choose **[Data Science Virtual Machine – Windows Server 2019](https://azuremarketplace.microsoft.com/marketplace/apps/microsoft-dsvm.dsvm-win-2019)** or **[Data Science Virtual Machine – Ubuntu](https://azuremarketplace.microsoft.com/marketplace/apps?search=Data%20science%20Virtual%20machine&page=1&filters=microsoft%3Blinux)** depending on your OS needs. |
50+
| Template virtual machine settings | Select **Use virtual machine without customization.**.
4251

43-
When you create a lab with the **Small GPU (Compute)** size, you can [install GPU drivers](./how-to-setup-lab-gpu.md#ensure-that-the-appropriate-gpu-drivers-are-installed). This option installs recent NVIDIA drivers and Compute Unified Device Architecture (CUDA) toolkit, which is required to enable high-performance computing with the GPU. For more information, see the article [Set up a lab with GPU virtual machines](./how-to-setup-lab-gpu.md).
52+
1. When you create a lab with the **Small GPU (Compute)** size, follow these steps to [install GPU drivers](./how-to-setup-lab-gpu.md#ensure-that-the-appropriate-gpu-drivers-are-installed).
53+
54+
These process installs recent NVIDIA drivers and the Compute Unified Device Architecture (CUDA) toolkit, which you need to enable high-performance computing with the GPU. For more information, see [Set up a lab with GPU virtual machines](./how-to-setup-lab-gpu.md).
4455

4556
## Template machine configuration
4657

4758
[!INCLUDE [configure template vm](./includes/lab-services-class-type-template-vm.md)]
4859

4960
The Data Science VM images come with many of data science frameworks and tools required for this type of class. For example, the images include:
5061

51-
- [Jupyter Notebooks](http://jupyter-notebook.readthedocs.io/): A web application that allows data scientists to take raw data, run computations, and see the results all in the same environment. It will run locally in the template VM.
62+
- [Jupyter Notebooks](http://jupyter-notebook.readthedocs.io/): A web application that allows data scientists to take raw data, run computations, and see the results all in the same environment. It runs locally in the template VM.
5263
- [Visual Studio Code](https://code.visualstudio.com/): An integrated development environment (IDE) that provides a rich interactive experience when writing and testing a notebook. For more information, see [Working with Jupyter Notebooks in Visual Studio Code](https://code.visualstudio.com/docs/python/jupyter-support).
5364

54-
The **Data Science Virtual Machine – Ubuntu** image is already provisioned with X2GO server and to enable students to use a graphical desktop experience. No further steps are required when setting up the template VM.
65+
The **Data Science Virtual Machine – Ubuntu** image is already provisioned with X2GO server to enable lab users to use a graphical desktop experience.
5566

5667
### Enabling tools to use GPUs
5768

58-
If you're using the **Small GPU (Compute)** size, we recommend that you verify that the Data Science frameworks and libraries are properly set up to use GPUs. You may need to install a different version of the NVIDIA drivers and CUDA toolkit. To properly configure the GPUs, you should consult the framework's or library's documentation.
69+
If you're using the **Small GPU (Compute)** size, we recommend that you verify that the Data Science frameworks and libraries are properly set up to use GPUs. You might need to install a different version of the NVIDIA drivers and CUDA toolkit. To configure the GPUs, you should consult the framework's or library's documentation.
5970

60-
For example, to validate that the GPU is configured for TensorFlow, connect to the template VM and run the following Python-TensorFlow code in Jupyter Notebooks:
71+
For example, to validate that TensorFlow uses the GPU, connect to the template VM and run the following Python-TensorFlow code in Jupyter Notebooks:
6172

6273
```python
6374
import tensorflow as tf
@@ -66,7 +77,7 @@ from tensorflow.python.client import device_lib
6677
print(device_lib.list_local_devices())
6778
```
6879

69-
If the output from the above code looks like the following, the GPU isn't configured for TensorFlow:
80+
If the output from the above code looks like the following, TensorFlow isn't using the GPU:
7081

7182
```python
7283
[name: "/device:CPU:0"
@@ -108,73 +119,86 @@ physical_device_desc: "device: 0, name: NVIDIA Tesla K80, pci bus id: 0001:00:00
108119

109120
### Provide notebooks for the class
110121

111-
The next task is to provide students with notebooks that you want them to use. Notebooks can be saved locally on the template VM so each student has their own copy. If you want to use sample notebooks from Azure Machine Learning, see [how to configure an environment with Jupyter Notebooks](../machine-learning/how-to-configure-environment.md#jupyter-notebooks).
122+
The next task is to provide lab users with notebooks that you want them to use. You can save notebooks locally on the template VM so each lab user has their own copy.
123+
124+
If you want to use sample notebooks from Azure Machine Learning, see [how to configure an environment with Jupyter Notebooks](/azure/machine-learning/how-to-configure-environment#jupyter-notebooks).
112125

113126
### Publish the template machine
114127

115-
When you [publish the template](how-to-create-manage-template.md#publish-the-template-vm), each student registered in the lab will get a copy of the template VM with all the local tools and notebooks you’ve set up on it.
128+
You make the lab VM available for lab users, you have to [publish the template](how-to-create-manage-template.md#publish-the-template-vm). The lab VM has all the local tools and notebooks that you configured previously.
116129

117-
## How students connect to Jupyter Notebooks?
130+
## Connect to Jupyter Notebooks
118131

119-
Once you publish the template, each student will have access to a VM that comes with everything you’ve already configured for the class, including the Jupyter Notebooks. The following sections show different ways for students to connect to Jupyter Notebooks.
132+
The following sections show different ways for lab users to connect to Jupyter Notebooks on the lab VM.
120133

121-
### For Windows VMs
134+
### Use Jupyter Notebooks on the lab VM
122135

123-
If you’ve provided students with Windows VMs, they need to connect to their lab VMs to use Jupyter Notebooks. To connect to a Windows VM, a student can use a remote desktop connection (RDP). For more information, see [Connect to a Windows lab VM](connect-virtual-machine.md#connect-to-a-windows-lab-vm).
136+
Lab users can connect from their local machine to the lab VM and then use Jupyter Notebooks inside the lab VM.
124137

125-
### For Linux VMs
138+
If you use a Windows-based lab VM, lab users can connect to their lab VMs through remote desktop (RDP). For more information, see how to [connect to a Windows lab VM](connect-virtual-machine.md#connect-to-a-windows-lab-vm).
126139

127-
If you’ve provided students with Linux VMs, students can Access Jupyter Notebooks locally after connecting to the VM. For instructions to SSH or connect using X2Go, see [Connect to a Linux lab VM](connect-virtual-machine.md#connect-to-a-linux-lab-vm).
140+
If you use a Linux-based lab VM, lab users can connect to their lab VMs through SSH or by using X2Go. For more information, see how to [connect to a Linux lab VM](connect-virtual-machine.md#connect-to-a-linux-lab-vm).
128141

129-
#### SSH tunnel to Jupyter server on the VM
142+
### SSH tunnel to Jupyter server on the VM
130143

131-
Some students may want to connect directly from their local computer directly to the Jupyter server inside their lab VMs. The SSH protocol enables port forwarding between the local computer and a remote server (in our case, the student’s lab VM), so that an application running on a certain port on the server is **tunneled** to the mapping port on the local computer. Students should follow these steps to SSH tunnel to the Jupyter server on their lab VMs:
144+
For Linux-based labs, you can also connect directly from your local computer to the Jupyter server inside the lab VM. The SSH protocol enables port forwarding between the local computer and a remote server (in our case, the user's lab VM). An application that is running on a certain port on the server is **tunneled** to the mapping port on the local computer.
132145

133-
1. In the Lab Services web portal ([https://labs.azure.com](https://labs.azure.com)), make sure that the Linux VM that you want to connect to is [started](how-to-use-lab.md#start-or-stop-the-vm).
134-
2. Once the VM is running, [get the SSH connection command](connect-virtual-machine.md#connect-to-a-linux-lab-vm-using-ssh) by selecting **Connect**, which will show a window that provides the SSH command string, which will look like the following string:
146+
Follow these steps to configure an SSH tunnel between a user's local machine and the Jupyter server on the lab VM:
147+
148+
1. Go to the [Azure Lab Services website](https://labs.azure.com)
149+
150+
1. Verify that the Linux-based [lab VM is running](how-to-use-lab.md#start-or-stop-the-vm).
151+
152+
1. Select the **Connect** icon > **Connect via SSH** to get the SSH connection command.
153+
154+
The SSH connection command looks like the following:
135155

136156
```shell
137157
ssh -p 12345 student@ml-lab-00000000-0000-0000-0000-000000000000.eastus2.cloudapp.azure.com
138158
```
139159

140-
3. On your local computer, launch a terminal or command prompt, and copy the SSH connection string to it. Then, add `-L 8888:localhost:8888` to the command string, which creates the **tunnel** between the ports. The final string should look like:
160+
Learn more about [how to connect to a Linux VM](connect-virtual-machine.md#connect-to-a-linux-lab-vm-using-ssh).
161+
162+
1. On your local computer, launch a terminal or command prompt, and copy the SSH connection string to it. Then, add `-L 8888:localhost:8888` to the command string, which creates the **tunnel** between the ports.
163+
164+
The final command should look as follows:
141165

142166
```shell
143167
ssh –L 8888:localhost:8888 -p 12345 student@ml-lab-00000000-0000-0000-0000-000000000000.eastus.cloudapp.azure.com
144168
```
145169

146-
4. Press **ENTER** to run the command.
147-
5. When prompted, provide the password to connect to the lab VM.
148-
6. Once you’re connected to the VM, start the Jupyter server using this command:
170+
1. Press **ENTER** to run the command.
171+
1. When prompted, provide the lab VM password to connect to the lab VM.
172+
1. When you’re connected to the VM, start the Jupyter server using this command:
149173

150174
```bash
151175
jupyter notebook
152176
```
153177

154-
7. Running the command will provide you with a URL in the terminal. The URL should look like:
178+
The command outputs a URL for the Jupyter server in the terminal. The URL should look like:
155179

156-
```bash
180+
```output
157181
http://localhost:8888/?token=8c09ecfc93e6a8cbedf9c66dffdae19670a64acc1d37
158182
```
159183

160-
8. Paste this URL into a browser on your local computer to connect and work on your Jupyter Notebook.
184+
1. Paste this URL into a browser on your local computer to connect and work on your Jupyter Notebook.
161185

162186
> [!NOTE]
163187
> Visual Studio Code also enables a great [Jupyter Notebook editing experience](https://code.visualstudio.com/docs/python/jupyter-support). You can follow the instructions on [how to connect to a remote Jupyter server](https://code.visualstudio.com/docs/python/jupyter-support#_connect-to-a-remote-jupyter-server) and use the same URL from the previous step to connect from VS Code instead of from the browser.
164188

165189
## Cost estimate
166190

167-
Let's cover a possible cost estimate for this class. We'll use a class of 25 students. There are 20 hours of scheduled class time. Also, each student gets 10 hours quota for homework or assignments outside scheduled class time. The VM size we chose was small GPU (compute), which is 139 lab units. If you want to use the Small (20 lab units) or Medium size (42 lab units), you can replace the lab unit part in the equation below with the correct number.
191+
This section provides a cost estimate for running this class for 25 users. There are 20 hours of scheduled class time. Also, each user gets 10 hours quota for homework or assignments outside scheduled class time. The VM size we chose was small GPU (compute), which is 139 lab units. If you want to use the Small (20 lab units) or Medium size (42 lab units), you can replace the lab unit part in the equation below with the correct number.
168192

169-
Here is an example of a possible cost estimate for this class:
193+
Here's an example of a possible cost estimate for this class:
170194
25 students \* (20 scheduled hours + 10 quota hours) \* 139 lab units \* 0.01 USD per hour = 1042.5 USD
171195
172196
>[!IMPORTANT]
173-
>Cost estimate is for example purposes only. For current details on pricing, see [Azure Lab Services Pricing](https://azure.microsoft.com/pricing/details/lab-services/).
197+
>This cost estimate is for example purposes only. For current details on pricing, see [Azure Lab Services Pricing](https://azure.microsoft.com/pricing/details/lab-services/).
174198
175199
## Conclusion
176200
177-
In this article, we walked through the steps to create a lab for a Jupyter Notebooks class. You can use a similar setup for other machine learning classes.
201+
In this article, you learned how to create a lab for a Jupyter Notebooks class and how user can connect to their notebooks on the lab VM. You can use a similar setup for other machine learning classes.
178202
179203
## Next steps
180204

0 commit comments

Comments
 (0)