Anaconda Python and Spyder with Windows Subsystem for Linux

Python on Windows can be used with Windows Subsystem for Linux. This can be advantageous because of easier compiler access. This procedure includes the graphical Spyder IDE if you so desire.

  1. Download Miniconda (50 MB)

    wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
    
  2. install Miniconda

    bash Miniconda3*.sh
    
  3. press space bar a few times till it asks you to type yes.

  4. prepend the path to ~/.bashrc (the default choice).

Setup Spyder IDE for WSL

  1. ensure X11 prereqs are installed, including:

    apt install libxcomposite libxss1
    

    If Spyder won’t start, look in the error message for such missing libraries.

  2. setup X11 for WSL

  3. install Spyder

    conda install matplotlib spyder
    

Notes

You may be missing X11 prereqs, which will be specified in the error message on starting GUI programs like Spyder. Look above the error:

ModuleNotFoundError: No module named ‘PyQt5.QtWebKitWidgets’

to see if things like libxcomposite or libxss etc. need to be installed via apt install.

Matplotlib trouble?

Notes on setting up Matplotlib for WSL

old Windows 10: WSL Ubuntu 14.04

Windows builds with WSL Ubuntu 16.04 / 18.04 work fine.

Very old Windows 10 Builds using Ubuntu 14.04 won’t work with MKL. You’ll get errors when using MKL-using modules like Scipy or Numpy on

import scipy; scipy.test()

OMP: Error #100: Fatal system error detected. OMP: System error #22: Invalid argument

Workaround: install MKL-less versions of these packages by

conda install nomkl