Closing Matplotlib plots with pvpython throws TypeError in Paraview 5.7

Hi, I just updated from Paraview 5.6 to 5.7. I had it configured to work with an existing conda python environment. It seems that if on opening a new Matplotlib plot along the lines of the following:

import matplotlib.pyplot as plt
fig, ax = plt.subplots(nrows=2, ncols=1)
  • on closing the plot, a TypeError is thrown:

Traceback (most recent call last):
File “”, line 1, in
File “/home/tjim/anaconda3/envs/sound6/lib/python3.7/site-packages/matplotlib/”, line 269, in show
return _show(*args, **kw)
File “/home/tjim/anaconda3/envs/sound6/lib/python3.7/site-packages/matplotlib/cbook/”, line 413, in wrapper
return func(*args, **kwargs)
File “/home/tjim/anaconda3/envs/sound6/lib/python3.7/site-packages/matplotlib/”, line 3309, in show
File “/home/tjim/anaconda3/envs/sound6/lib/python3.7/site-packages/matplotlib/backends/”, line 1100, in mainloop
signal.signal(signal.SIGINT, old_signal)
File “/home/tjim/anaconda3/envs/sound6/lib/python3.7/”, line 47, in signal
handler = _signal.signal(_enum_to_int(signalnum), _enum_to_int(handler))
TypeError: signal handler must be signal.SIG_IGN, signal.SIG_DFL, or a callable object

This happens if I run it from a script (i.e. pvpython or in a pvpython interpreter. At first, I suspected the QT module and have recompiled several times with different QT configurations and environment variables but I still got the same error. To confirm that it wasn’t me messing up the compilation, I also created a fresh Python 3.7 environment pulled the latest Conda-Forge build. It still produces this error on closing plots. Can you help me diagnose the issue? It doesn’t throw this error if I run the ‘ordinary python’, as oposed to pvpython (using the same libraries, I believe).

I also tried with PV 5.8.0-RC1 and it still seems to have this problem.

Thanks and regards,

Is this on Linux? What cmake version do you use to compile ParaView?

Can you try compiling paraview with


@Ben Boeckel

I don’t know how ParaView could interfere with this stack. I wonder if something else is setting up a handler and confusing it. What is old_signal when this happens?

It is on CentOS 7. I tried compiling with 3.14.4 and 3.16.3, they gave the same issue.

I’ll try with VTK_PYTHON_OPTIONAL_LINK off, thanks for the suggestion.

Edit: the issue is still present with VTK_PYTHON_OPTIONAL_LINK set to off

While digging for hints two days ago, I had posted in this Julia thread which seemed to have a similar issue:

It seems to suggest that old_signal is returning a None.

Just following the Julia thread, they seem to have nailed it down to a Matplotlib bug.

I’ve made an MR to update matplotlib to 3.2.1 here. If it goes smoothly, it will be in 5.8.1, but I don’t think it’s worth holding it up.