PyQT/Matplotlib in Windows Subsystem for Linux

Prereqs for Matplotlib GUI with WSL

install Xming X11 server for WSL

sudo apt install libqtgui4

Anaconda Python Matplotlib on WSL

setup Anaconda Python on WSL

conda install matplotlib

Non-Anaconda Install Matplotlib for WSL

If you don’t want to use Anaconda Python for WSL:

sudo apt install python-matplotlib

Non-X11 Matplotlib use

before any other Python code have:

import matplotlib

you should see agg printed. This will allow writing figures to disk, but will disallow displaying them on screen.

Matplotlib errors on WSL

Without X11 or agg backend, attempting:

import matplotlib

may result in error

ImportError: cannot open shared object file: No such file or directory