Thursday, March 22, 2018

Access Jupyter notebooks on Azure DSVM

Data Science VM, or DSVM is a serials VM offers from Microsoft Azure Cloud platform. It comes installed with a comprehensive tools for data science projects. In addition, it also by default includes several iPython notebooks as sample scenarios for users to jump start. How to access and run experiments in them? It can be tricky for beginners. In this blog, we answer this question specifically for Linux Ubuntu DSVM, or Linux DLVM (Deep Learning version, NC series).

When logging in your VM, you can see two directories "Desktop" and "notebooks". All the sample notebooks stay in the "notebooks" directory. When we access Jupyter notebooks, we are actually access the notebooks on Jupyter server. We can access Jupyter server by typing https://[vm_ip]:[port_no] in a browser tab.

In DSVMs, there is a default port 8000 already configured and the Jupyter server is automatically launched when the DSVM is provisioned. The user can access the "notebooks" directory by using address https://[vm_ip]:8000 and run all the notebooks under this directory right away.
Sometimes, you need to manually start the Jupyter server for other reasons (e.g. your notebooks are stored in a different directory). You need to perform following steps.

  1. Navigate to your home directory to locate file file (see screeshot below). If the file does not exisit, execute "jupyter notebook --generate-config" in console.  
  2. Add c.NotebookApp.notebook_dir = ‘/home/mylogin/’ to make Jupyter server point to it when started (see screenshot below). You can use a different directory path as well.  
  3. Execute "jupyter notebook password" and set the password in console. 4. Execute "jupyter notebook" in console to start the Jupyter server. When the server is launched, the output will look similar to below screenshot. Locate the port number, which is usually 9999 as shown below.
  4.  Go to the overview page of your VM in Azure portal to add in-bound rule for port 9999 (It can be another port if you have other configurations). 
  5.  Now you can access the above set directory at https://[vm_ip]:9999

No comments:

Post a Comment