Wiki‎ > ‎

Windows Subsystem for Linux (WSL), Anaconda, Conda, Jupyter

posted Oct 24, 2017, 11:31 AM by Dong Xu   [ updated Mar 20, 2018, 5:54 PM ]
Wow!!! Starting in Windows 10 Anniversary Update, the Windows Subsystem for Linux can invoke native Windows binaries from the Linux console and Linux binaries from a Windows console

Install Guide:

This python script allows installing and switching ANY Linux distro to WSL in Win10

Switch WSL user accounts:

Setup guide

System setup

To run 3D program, need to install Mesa, Mesa-libGL1, xwininfo, libXi6, Mesa-demo-x, libGLU1, htop  (real 3D programs don't work!)

After finish installing OpenSUSE 42.3 in WSL, setup MobaXterm
I already had a persistent home dir set up within MobaXterm, so I chose it as the startup folder for launching the WSL shell. The point is that Microsoft doesn't want users to touch any of its WSL files, so even user's home dir in WSL is inaccessible from Windows. Therefore, using a dir outside WSL makes the most sense because data files can be accessed by both Windows and WSL. This is very important.

Download (ver 5.0 had SSLE problems...) from and sudo install to /usr/local

In order to use Firefox or Chrome for Windows, add it to Windows path
  1. Start the System Control Panel applet (Start - Settings - Control Panel - System).
  2. Select the Advanced tab.
  3. Click the Environment Variables button.
  4. Under System Variables, select Path, then click Edit.
vi /mnt/d/MobaXterm/slash/bin/xdg-open  add firefox.exe to the list. xdg-open is a launcher used in Mobaxterm

    if [ x"$BROWSER" = x"" ]; then

Anaconda root env already has jupyter installed, first thing to set up a passwd:  jupyter notebook password

Matplotlib works fine in WSL.

nglview in pytraj and HTMD had issues with Widget Javascripts...  see
Also the version in bioconda was 0.65, Current version on GIT is 1.0b2.
Follow the steps to install the latest nglview to Pytraj, HTMD, and other packages:

conda create -n pytraj python=3.6
source activate pytraj
conda install pytraj -c ambermd --name pytraj
conda install matplotlib --name pytraj
conda install nglview -c bioconda --name pytraj (this installs the 0.65 version)
pip install nglview==1.0b2
jupyter-nbextension enable nglview --py --sys-prefix
jupyter nbextension enable --py --sys-prefix widgetsnbextension # enable ipywidgets since we installed via pip
jupyter notebook

conda create -n htmd python=3.6
conda config --add channels acellera
conda config --add channels psi4
source activate htmd
conda install htmd --name htmd (this installs matplotlib and nglview 0.65 version)
pip install nglview==1.0b2
conda config --remove channels acellera
conda config --remove channels psi4

You will a warning when you use pip to install the lastest nglview:
Installing collected packages: ipywidgets, nglview
  Found existing installation: ipywidgets 5.2.2
    DEPRECATION: Uninstalling a distutils installed project (ipywidgets) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
    Uninstalling ipywidgets-5.2.2:
      Successfully uninstalled ipywidgets-5.2.2
  Found existing installation: nglview 0.6.5
    Uninstalling nglview-0.6.5:
      Successfully uninstalled nglview-0.6.5
Successfully installed ipywidgets-7.0.0 nglview-1.0b2

To Test nglview and ipywidgers installation:

import nglview as nv

import ipywidgets

1. Conda installation
conda install -c conda-forge jupyterhub  # installs jupyterhub and proxy
conda install notebook  # needed if running the notebook servers locally

Error: "Failed to find proxy ['configurable-http-proxy']"
For some reason jupyterhub must find configurable-http-proxy in /usr/bin, the default location is /garlic/apps/anaconda3/bin

Fix: cp -s /garlic/apps/anaconda3/bin/configurable-http-proxy /usr/bin/

2. Conda pip installation
pip install jupyterhub In yast2: install nodejs package for npm (location: /usr/bin/npm) pip install notebook # needed if running the notebook servers locally
pip will generate configurable-http-proxy in /usr/bin so there is no problem.

3. sudo jupyterhub 
default on port 8000, can login with server username/passwd, but fail to start server
Error: Unhandled error starting server: [Errno 2] No such file or directory: 'jupyterhub-singleuser'

Fix: generate a default config file, sudo jupyterhub --generate-config

Tell it to use the absolute-path for jupyterhub-singleuser in your config, rather than relying on PATH:
c.Spawner.cmd = '/garlic/apps/anaconda3/bin/jupyterhub-singleuser'

To check path:
sudo -s env PATH=.... which jupyterhub /garlic/apps/anaconda3/bin/jupyterhub which jupyterhub-singleuser /garlic/apps/anaconda3/bin/jupyterhub-singleuser

It is recommended to store configuration files in the standard UNIX filesystem location, i.e. /etc/jupyterhub.

Start the server! jupyterhub -f /etc/jupyterhub/

To have jupyterhub access a new env, create a new kernel, see

ipython kernel install --user --name pytraj

Go back to the Jupyterhub dashboard, reload the page, now you should have another option in the New menu that says pytraj.

In order to use your new kernel with an existing notebook, click on the notebook file in the dashboard, it will launch with the default kernel, then you can change kernel from the top menu Kernel > Change kernel.

Having issues with nglview on garlic jupyterhub... not showing structure, no error message:

For system-wide:
sudo jupyter-nbextension enable nglview --py --sys-prefix
sudo jupyter nbextension enable --py --sys-prefix widgetsnbextension

For a user:
jupyter nbextension enable --py --user widgetsnbextension
jupyter-nbextension enable nglview --py --user