Matplotlib 2.0 in Cygwin 64-bit on Windows for Python 3 and Python 2.7

Related: install Matplotlib without compiling via pip

Matplotlib Cygwin pip install

  1. Command Prompt:

     setup-x86_64 -P pkg-config ghostscript libfreetype-devel libpng-devel libgtk2.0-devel gcc-g++ git openbox python3-numpy python3-pyqt5 python3-devel
  2. Cygwin Terminal:

     easy_install-3.6 pip
     pip install --upgrade six
     pip install matplotlib

Alternative: Matplotlib compile

You can just use the process above, unless you want to compile Matplotlib on Cygwin from source code for the latest Matplotlib beta.

cd /tmp

git clone git://

cd matplotlib

python --quiet install

Test result


Python 3.6.1

import matplotlib


Matplotlib Cygwin plotting with visible figures

To create a visible Matplotlib figure in Cygwin, you need a basic X11 system running by:

  1. Windows Start button, All App, Cygwin-X, Openbox.
  2. Right click and select Terminals, Xterm from the blank Openbox desktop.

To test your entire Matplotlib / Cygwin-X / Openbox configuration, type from the Cygwin X11 Openbox Xterm terminal:

from numpy.random import rand
import matplotlib
matplotlib.use('qt5agg') #must be before other matplotlib commands
from matplotlib.pyplot import figure,show

If that works, you can permanently set your default Cygwin Matplotlib backend to qt5agg.

If you still have problems creating Matplotlib plots from Cygwin with the graphical desktop, you can create and save figures to .eps or .png etc. without starting X11. Example:

from matplotlib.pyplot import figure,show