Python scripts use wrong python version in KNIME 3.7

I just upgraded from KNIME 3.6 to 3.7 and I notice that python nodes no longer work correctly. Specifically, all newly added python scripting nodes will only use the python2 executable even if the node is switched to use python3.

For example, if I drag in a new Python Scripting node and run:

import sys
print(sys.executable)

I get the path to my python2 executable (as specified in the KNIME preferences):

C:\Users\Josh\Anaconda3\envs\py2\python.exe

This is all as expected, however if I then go to the node options and switch from the default Python2 to Python 3 option, Apply, reset the workspace, and run the same code I get the same python2 path as output. Even if I apply, close the config window, re-open the node config, confirm python3 is still specified and run again – the output is the same.

Interestingly, if I run a python scripting node from a workflow last saved under KNIME 3.6 (and previously set to use python3) I get the expected output (my python3 executable as specified in the KNIME preferences):

C:\Users\Josh\Anaconda3\python.exe

Any idea on how to get the nodes to use python3 in KNIME 3.7?

Okay, a bit of fast progress on this:

To get the switch from python2 to python3 to register in KNIME 3.7, you need to save the workflow -> close the workflow -> re-open the workflow and the nodes will use the correct version of python. You do not need to restart KNIME itself.

3 Likes

Hi joshuahoran,

Thanks for reporting this bug! This is definitely not the intended behavior. I submitted a ticket for it and we will try to provide a patch for it as fast as possible.

Marcel

Hi joshuahoran,

We have developed a patch for this bug. It should be fixed with the next release of KNIME Analytics Platform. Again, thanks for reporting!

Marcel

2 Likes