Issue with plotting in Python Scripting Node

i wanted to create an image output in a python scripting node [Python 3 - Anaconda] for fast prototyping. This has always worked so far, but after an update to KNIME 3.6.0 this now fails.

import matplotlib.pyplot as plt
plt.ylabel(‘some numbers’)

Traceback (most recent call last):
File “C:\Program Files\KNIME\plugins\org.knime.python2_3.6.0.v201807061638\py\”, line 278, in execute
exec(source_code, self._exec_env, self._exec_env)
File “”, line 7, in
File “C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\”, line 253, in show
return _show(*args, **kw)
File “C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\”, line 208, in show
File “C:\ProgramData\Anaconda3\lib\site-packages\matplotlib\backends\”, line 1118, in mainloop
signal.signal(signal.SIGINT, signal.SIG_DFL)
File “C:\ProgramData\Anaconda3\lib\”, line 47, in signal
handler = _signal.signal(_enum_to_int(signalnum), _enum_to_int(handler))
ValueError: signal only works in main thread

Could you please support me.

Best Regars

Hi André,

We introduced threading for Python 3 in KNIME Python 3.6.0 to support some use cases that came with KNIME Deep Learning - Keras, which is built on top of your Python integration.
You could try to change to Python 2 via the node’s Options tab, if Python 2 is okay with you.
For Python 3, there is no workaround as far as I know, unfortunately.

Thanks for reporting that issue! And sorry for all the trouble. We’ll try to move script execution back to the main thread.


Hi Marcel,
I switched the whole system and lecture to Python3 (and only Python 3). This is a nightmare and a lot of extra work. .Could you please give me an indication when its will be fixed an released?

Best Regards

We’ll target the next bug fix release, i.e., 3.6.2. I can’t give you a timeline, unfortunately, as we just released 3.6.1.
If the plot does not need to be interactive, you could also use the Python View node to output the plot as an image.
Otherwise, downgrading to KNIME 3.5.3 seems to be the only solution at the moment, I’m afraid. Please find a download link here.

I’ll keep you posted on our progress. Nightly builds that contain a respective fix will be available earlier, if those are an option for you.

I upgraded to “Welcome to KNIME 3.6.2” but the bug is still present. Can you give me a hit, when it will be fixed?


Hi André,

The fix for this is under active development but didn’t make it into 3.6.2 in time. We’ll try to get it released as soon as possible.


This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.