[Matplotlib-devel] Manylinux external library test case - matplotlib, tk

Matthew Brett matthew.brett at gmail.com
Mon Apr 25 13:37:19 EDT 2016


Hi,

I am building matplotlib manylinux wheels:

https://github.com/matthew-brett/manylinux-builds/blob/master/build_matplotlibs.sh

The problem is, what to do about the default matplotlib tk optional dependency?

Normally, matplotlib builds against the installed system tk libs :
https://github.com/matplotlib/matplotlib/blob/master/setupext.py#L1522

When building a manylinux wheel, we can only build against the tk libs
/ headers on the manylinux docker image, by doing `yum install -y
tk-devel` before building.

This means that the tk that matplotlib is built against, is different
from the one that Python uses with `import Tkinter`.  I suppose that
is what causes the following, when building matplotlib with tk-devel
installed:

>>> import matplotlib
>>> matplotlib.get_backend()
u'TkAgg'
>>> import matplotlib.pyplot as plt
>>> plt.plot(range(10))
[<matplotlib.lines.Line2D object at 0x7f2a8e4b4390>]
>>> plt.show()
Segmentation fault

I don't immediately see a good way to deal with this.  Any thoughts?

Cheers,

Matthew


More information about the Matplotlib-devel mailing list