Compiling Matplotlib with TkAgg and pip
Normally we install precompiled Matplotlib via
conda install matplotlibor
pip install matplotlibBuild 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