You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Set up a lab to teach data science with Python and Jupyter Notebooks
20
+
This article outlines how to set up a template machine in Lab Services with the tools needed to teach students how to use [Jupyter Notebooks](http://jupyter-notebook.readthedocs.io/), and how students can connect to their notebooks on their virtual machines (VMs).
20
21
21
-
This article outlines how to set up a template machine in Lab Services with the tools needed to teach students how to use [Jupyter Notebooks](http://jupyter-notebook.readthedocs.io). Jupyter Notebooks is an open-source project that lets you easily combine rich text and executable [Python](https://www.python.org/) 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.
22
+
Jupyter Notebooksis 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.
22
23
23
24
## Lab configuration
25
+
To set up this lab, you need access to an Azure subscription and a lab account to get started. Discuss with your organization's admin if you can get access to an existing Azure subscription. If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free/) before you begin.
24
26
25
-
To set up this lab, you need an Azure subscription and lab account to get started. If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free/) before you begin. Once you get an Azure subscription, you can create a new lab account in Azure Lab Services. For more information about creating a new lab account, see [tutorial to setup a lab account](tutorial-setup-lab-account.md). You can also use an existing lab account.
26
-
27
-
### Lab Account Settings
27
+
Once you have access to an Azure subscription, you need to create a new lab account in Azure Lab Services. For instructions on creating a lab account, see the [tutorial to setup a lab account](tutorial-setup-lab-account.md). You can also use an existing lab account.
28
28
29
+
## Lab account settings
29
30
Enable the settings described in the table below for the lab account. For more information about how to enable marketplace images, see [specify Marketplace images available to lab creators](specify-marketplace-images.md).
30
31
31
32
| Lab account setting | Instructions |
32
33
| ------------------- | ------------ |
33
-
| Marketplace image | Enable the [Data Science Virtual Machine - Windows 2019](https://azuremarketplace.microsoft.com/marketplace/apps/microsoft-dsvm.dsvm-win-2019) image for use within your lab account. |
34
-
35
-
>[!TIP]
36
-
>This article will focus on configuring a template machine that uses the Windows Server operating system. It's also possible to set up a data science class with Python and Jupyter Notebooks using [Data Science Virtual Machine for Linux (Ubuntu)](https://azuremarketplace.microsoft.com/marketplace/apps/microsoft-dsvm.ubuntu-1804) images from the Azure Marketplace.
34
+
| Marketplace image | Inside your lab account, enable one of the Azure Marketplace images based on your operating system needs: <br/><ul><li>Data Science Virtual Machine – Windows Server 2019</li><li>Data Science Virtual Machine – Ubuntu 18.04</li></ul> |
37
35
38
-
### Lab settings
36
+
> [!NOTE]
37
+
> This article uses the Data Science virtual machine images available on the Azure marketplace because they are preconfigured with Jupyter Notebook. These images, however, also include many other development and modeling tools for data science. If you don't want the extra tools and want a lightweight setup with just Jupyter notebooks, create a custom virtual machine image. For an example, see the [Installing JupyperHub on Azure](http://tljh.jupyter.org/en/latest/install/azure.html) article. Once the custom image is created, you can upload it to a shared image gallery to use the image inside Azure Lab Services. Learn more about [using Shared Image Gallery in Azure Lab Services](how-to-attach-detach-shared-image-gallery.md).
39
38
40
-
Use the settings in the table below when setting up a classroom lab. For more information how to create a classroom lab, see [set up a classroom lab tutorial](tutorial-setup-classroom-lab.md).
39
+
## Lab settings
40
+
Configure **Virtual machine size** and **Virtual machine image** settings as shown in the following table when setting up a classroom lab. For instructions on creating a classroom lab, see [Set up a classroom lab](tutorial-setup-classroom-lab.md).
41
41
42
42
| Lab settings | Value/instructions |
43
-
| ------------ | ------------------ |
44
-
|Virtual Machine Size|Small GPU (Compute). This size is best suited for compute-intensive and network-intensive applications like Artificial Intelligence and Deep Learning. |
45
-
|Virtual Machine Image|Data Science Virtual Machine - Windows 2016|
43
+
| ------------ | ------------------ |
44
+
|Virtual machine size | <p>The size you pick here depends on the workload you want to run:</p><ul><li>Small or Medium – good for a basic setup of accessing Jupyter Notebooks</li><li>Small GPU (Compute) – best suited for compute-intensive and network-intensive applications like Artificial Intelligence and Deep Learning</li></ul> |
45
+
|Virtual machine image | <p>Choose one of the following images based on your operating system needs:</p><ul><li>[Data Science Virtual Machine – Windows Server 2019](https://azuremarketplace.microsoft.com/marketplace/apps/microsoft-dsvm.dsvm-win-2019)</li><li>[Data Science Virtual Machine – Ubuntu 18.04](https://azuremarketplace.microsoft.com/marketplace/apps/microsoft-dsvm.ubuntu-1804?tab=Overview)</li></ul> |
46
46
47
-
## Template machine
48
47
49
-
The [Data Science Virtual Machine - Windows 2019](https://azuremarketplace.microsoft.com/marketplace/apps/microsoft-dsvm.dsvm-win-2019) image provides the necessary deep learning frameworks and tools required for this type of class. The image includes Jupyter Notebooks and Visual Studio Code. [Jupyter Notebooks](http://jupyter-notebook.readthedocs.io) is a web application that allows data scientists to take raw data, run computations, and see the results all in the same environment. For our template machine, the web application will be running locally. [Visual Studio Code](https://code.visualstudio.com/) is an 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).
48
+
## Template virtual machine
49
+
Once you create a lab, a template VM will be created based on the virtual machine size and image you chose. You configure the template VM with everything you want to provide to your students for this class. To learn more, see [how to manage the template virtual machine](how-to-create-manage-template.md).
50
50
51
-
The remaining task to set up the class is to provide local notebooks. For instructions how to use the Azure Machine Learning samples, see [how to configure an environment with Jupyter Notebooks](../../machine-learning/how-to-configure-environment.md#jupyter). You can also provide your own notebooks on the template machine. The notebooks will be copied to all student machines when the template is published.
51
+
The Data Science VM images by default come with many of data science frameworks and tools required for this type of class. For example, the images include:
52
52
53
-
## Cost estimate
53
+
-[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.
54
+
-[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).
54
55
55
-
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 virtual machine size we chose was small GPU (compute), which is 139 lab units.
56
+
### Provide notebooks for the class
57
+
The next task is to provide students with notebooks that you want them to use. To provide your own notebooks, you can save notebooks locally on the template VM.
56
58
57
-
Here is an example of a possible cost estimate for this class:
59
+
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).
60
+
61
+
### Optional: enable graphical desktop for Linux
62
+
The **Data Science Virtual Machine – Ubuntu** image is already provisioned with X2GO server and is ready to accept client connections. No further steps are required when setting up the template VM.
63
+
64
+
### Publish the template machine
65
+
When you publish the template, each student registered to your lab will get a copy of the template VM with all the local tools and notebooks you’ve set up on it.
66
+
67
+
## How students connect to Jupyter Notebooks?
68
+
Once you publish the template, each student will have access to a VM that comes with everything you’ve preconfigured for the class, including the Jupyter Notebooks. The following sections show different ways for students to connect to Jupyter Notebooks.
69
+
70
+
### For Windows VMs
71
+
If you’ve provided students with Windows VMs, they need to connect to their VMs and use Jupyter Notebooks that are available locally on them.
72
+
73
+
To connect to a Windows VM, a student can use a remote desktop connection (RDP). For detailed steps, see [how to access a classroom lab](how-to-use-classroom-lab.md).
74
+
75
+
A student using a Mac or Chromebook can follow instructions from the following articles to connect to the Data Science VM.
76
+
77
+
-[Connect to a VM using Remote Desktop Protocol on a Mac](connect-virtual-machine-mac-remote-desktop.md)
78
+
-[Connect to a VM using Remote Desktop Protocol on a Chromebook](connect-virtual-machine-chromebook-remote-desktop.md)
79
+
80
+
### For Linux VMs
81
+
If you’ve provided students with Linux VMs, there are several options students can use to connect to their Jupyter Notebooks in the VMs:
82
+
83
+
- Access Jupyter Notebooks locally after connecting to the VM
84
+
- SSH to the VM for terminal sessions
85
+
- X2Go connection to the VM for graphical sessions
86
+
- Use SSH tunneling to connect from the student’s local computer directly to the Jupyter Server on the VM.
87
+
88
+
### SSH to virtual machine
89
+
Students can connect via SSH to their Linux VMs from a terminal session. For detailed steps, see [how to access a classroom lab](how-to-use-classroom-lab.md). If they are using a Windows client machine, they will need to enable an SSH client by downloading [PuTTY](https://www.putty.org/) or enabling [OpenSSH in Windows](https://docs.microsoft.com/windows-server/administration/openssh/openssh_install_firstuse) to SSH from the command prompt.
90
+
91
+
1. Start the VM.
92
+
2. Once the VM is running, click **Connect**, which will pop up a dialog box that provides the SSH command string, which will look like the following sample:
3. Go to your command prompt or terminal, and paste in this command, and then press **ENTER**.
98
+
4. Enter the password to sign in to the VM.
99
+
100
+
Once the students are connected to the VMs, they can access and run Jupyter Notebooks locally.
101
+
102
+
### X2Go to virtual machine
103
+
The **Data Science Virtual Machine – Ubuntu** image is already provisioned with X2GO Server and is ready to accept client connections. To connect to the graphical desktop of the Linux machine, students need to follow these one-time steps to set up X2Go on their client machines:
104
+
105
+
1. Download and install the [X2Go client](https://wiki.x2go.org/doku.php/doc:installation:x2goclient) for your client platform.
106
+
2. In the [Azure Lab Services portal](https://labs.azure.com), make sure that the Linux VM you want to connect to is started.
107
+
3. Once the VM is running, click **Connect**, which will pop a dialog box that provides the SSH command string, which will look like the following sample:
58
108
59
-
25 students \* (20 scheduled hours + 10 quota hours) \* 139 lab units \* 0.01 USD per hour = 1042.5 USD
2. Enter the password to connect to the VM. (You may have to give X2Go permission to bypass your firewall to finish connecting.)
130
+
3. You should now see the graphical interface for your Ubuntu Data Science VM.
131
+
132
+
133
+
### SSH tunnel to Jupyter server on the VM
134
+
Some students may want to connect directly from their local computer directly to the Jupyter server inside their 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:
135
+
136
+
1. In the [Azure Lab Services portal](https://labs.azure.com), make sure that the Linux VM that you want to connect is started.
137
+
2. Once the VM is running, click **Connect**, which will pop a dialog box that provides the SSH command string, which will look like the following string:
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:
8. Paste this URL into a browser on your local computer to connect and work on your Jupyter Notebook.
160
+
161
+
> [!NOTE]
162
+
> 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.
163
+
164
+
165
+
## Cost estimate
166
+
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 forhomework or assignments outside scheduled class time. The virtual machine 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 partin the equation below with the correct number.
167
+
168
+
Here is an example of a possible cost estimate for this class:
169
+
25 students * (20 scheduled hours + 10 quota hours) * 139 lab units * 0.01 USD per hour = 1042.5 USD
60
170
61
171
Further more details on pricing, see [Azure Lab Services Pricing](https://azure.microsoft.com/pricing/details/lab-services/).
62
172
63
173
## Conclusion
64
-
65
174
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.
0 commit comments