Compiling Matplotlib with TkAgg and pip

Normally we install precompiled Matplotlib via

conda install matplotlib

or

pip install matplotlib

Build Matplotlib with Tk

If you need to install/upgrade Matplotlib via pip and need TkAgg:

apt install tk-dev libpng-dev libffi-dev dvipng texlive-latex-base

pip install cairocffi

pip install --upgrade matplotlib