This post is still in working progress …

Installing WSL 2

Basically this is straightforward, basically just following the official documents here: https://docs.microsoft.com/en-us/windows/wsl/install-win10

dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart

Restart your PC

dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
wsl --set-default-version 2

Install the preferred Linux distribution

View of Linux distributions in the Microsoft Store

Installing Anaconda

Start WSL Ubuntu, apply updates.

apt-get update -y
apt-get upgrade -y

Get and install the latest version of anaconda installer version from: https://www.anaconda.com/products/individual

wget https://repo.anaconda.com/archive/Anaconda3-2021.05-Linux-x86_64.sh
bash Anaconda3-2021.05-Linux-x86_64.sh

For now it’s ready to type

jupyter lab

to start the Jupyter Lab in the host system, but highly likely you would see the similar error below:

To fix this, generate jupyter config file and disable use_redirect_file.

jupyter notebook --generate-config

Edit the config file ~/.jupyter/jupyter_notebook_config.py, looking for c.NotebookApp.use_redirect_file, uncomment it (remove #) and change its value to False: c.NotebookApp.use_redirect_file = False. The add the line to ~/.bashrc, please change it according to the browser you’re using:

export BROWSER='/mnt/c/Program Files/Google/Chrome/Application/chrome.exe'

Restart the WSL or source ~/.bashrc