Add Python 3.10 to access DRS URIs in JupyterLab

Allie Cliffe
  • Updated

Terra Azure Interactive Analysis Cloud Environments currently default to using Python 3.8. This article describes how to configure the Cloud Environment to use Python 3.10 instead. Note that Python 3.10 or later is required by terra-notebook-utils to resolve AnVIL DRS URIs.

DRS URIs in Jupyterlab requires non-default Python 3.10

Python 3.10 is required by terra-notebook-utils to resolve AnVIL DRS URIs. But current JupyterLab VMs include Python 3.8 by default. You can use the new Python kernel with specific Python release version in your Jupyter Lab VM with the steps below. 

Please visit and review the official Conda documentation from https://docs.conda.io/projects/conda/en/latest/commands/create.html.

Update the Python version in your JupyterLab instance

1. Open a Cloud Environment terminal 

1.1. Click on the Cloud Environment icon in the right sidebar. 

1.2. Select the Terminal card in the Launcher tab

Screenshot-of-terminal-card-in-bottom-left-of-JupyterLab-launcher.png

2. Install Python 3.10 using the terminal

2.1. Load the Python conda environment with the following command.

conda activate /anaconda/envs/azureml_py310_sdkv2

2.2. Install the Python 3.10 kernel. Note that you may be prompted to proceed and will need to type "Y" to complete the execution. 

conda install ipykernel

What to expect

This package will take a minute or so to install. You will get a running output of the individual packages as they are installed. Note that the output is quite long

Note that you can add other Python versions for the new Jupyter kernels. Please check the other available Python versions at https://www.python.org/downloads/.

3. Switch to the Jupyter 3.10 kernel

3.1. In your notebook, go to the Kernel menu (top left) and select Change Kernel (at the bottom of the dropdown list). 

Add-Python-3.10-to-JupyterLab_Screenshot-of-change-kernel-menu-from-top-with-Change-kernel-selected-from-the-dropdown.png

3.2. Select Python [conda env:azureml_py3.10_sdkv2] from the dropdown menu. 

When do you have to reinstall?Once you go through these steps to select the kernel, it will persist when you open the notebook again, even if you pause the JupyterLab cloud environment. If you delete the JupyterLab VM, however, you will have to reinstall the Python 3.10 kernel following the instructions above. 

Note that you can also use this public workspace to add different Python versions and kernels to your cloud environment. 

 

Was this article helpful?

Comments

0 comments

Please sign in to leave a comment.