Python Community node failed

Hi there,

I’m now starting to use Python Script node. The normal python node (like Python view, Python Script, etc) can be run successfully, while Community node (like Python Plot, Open in Python, etc.) failed with the following error:
execute failed: java.lang.runtimeexception: java.io.ioexception: cannot run program “python”: createprocess error=2, the system cannot find the file specified.

Python 3 Conda environment installed on windows10 seems no problem so that normal node run normally,
but why only community node failed? Do I need any further configuring?

Your help is greatly appreciated.

The Python community nodes don’t have anything to do with the “normal” Python nodes. They are completely separate and therefore they don’t share configuration.

Hi there @qianyi,

under File-->Preferences-->KNIME there should be Python Scripting.

Br,
Ivan

Hi,
thanks for your reply.

I tried to set the “path to the local python executable” of Python Scripting like the following:
C:\Users\XXXX\AppData\Local\Continuum\anaconda3\python.exe

Do I need to change other setting here?
I still get some other execute fail error after done the path setting.

Hi @qianyi,

not sure. You can check your log for more info (...\knime-workspace\.metadata\knime\knime.log). I also add @MPICBG-TDS as extension creator/owner…

Br,
Ivan

Hi,
Thanks.
I checked the log. It contains the error information like the following (attached text).
Sounds like python execution error, but only fails in community nodes.

2020-01-23_10_48_36_332_ERROR_KNIME-Worker-13-Python_Plot_0_43_PythonPlotNodeModel_Python.txt (3.6 KB)

2020-01-22_13_15_24_795_ERROR_KNIME-Worker-9-Python_Snippet_0_42_PythonSnippetNodeModel_P.txt (3.0 KB)

Hi,
I’m sorry but the Python community nodes do not yet work with Python3 but should work with Python2.

Antje

4 Likes

Hi,
Understood!

Should I change the “Python version to use by default” to Python 2 in Preferences - KNIME - Python?

I have already created a python 2 conda environment here,
and set the path of Python Scripting to this new environment.
But I still have community Python node failed with ImportError…

Thanks.

You should not mix up the Python Settings with the official Python nodes.
I will attach a screenshot: This is where you should set your python path.

Best.

2 Likes

Thank you for your further information.

I think I have understood, but please let me confirm the problem again.
Currently my python settings is as the following screenshot.

\py2_knime\python.exe is created from KNIME.
So I should change this path to original anaconda python executable place which is:
C:\Users\XXX\AppData\Local\Continuum\anaconda3\python.exe
and change this python environment here to Python2 (currently is Python3).

I looked at you latest error-message again. Did you try to run the default script?
pyOut = kIn

What do you mean with “created from KNIME”?
Why do your backslashes look so strange?
Can you check if this is really the correct path to python2?

It’s fine to have it within an environment. But in my case (Win10) the path looks like this:
C:\Users\XXX\Anaconda3\envs\py2\python.exe

What do you mean with “created from KNIME”?

\py2_knime\ was created by clicking the “New environment…” as the following screenshot.

Why do your backslashes look so strange?
Can you check if this is really the correct path to python2?

Perhaps it is because of the Japanese OS making the backslashes look strange.
I just installed the anaconda to the default path, and as the result the path looks like the following. Probably since I installed the anaconda for “Just me” instead of “All Users”.

After I changed the local python executable path from Python3 to Python2, the error have changed like the following (attached text) when I run the Python Plot with 2D scatter plot template.

ERROR_KNIME-Worker-10-Python_Plot_.txt (5.8 KB)

Thanks!

Okay, your error message suggests, that the python executable has been found but it fails to execute the script successfully.
You can try the following. Look at the KNIME console error message (you may want to clean the console messages before) and copy the path of the python-file:

ERROR Python Plot          2:35       Traceback (most recent call last):
ERROR Python Plot          2:35         File "C:\Users\XXX\AppData\Local\Temp\analyze3437511062926981065.py", line 3, in <module>
ERROR Python Plot          2:35           from pylab import * ...

Try to execute the script with python:
python C:\Users\XXX\AppData\Local\Temp\analyze3437511062926981065.py

Does it throw any error message?

Thanks for your advice.

Try to execute the script with python:
python C:\Users\XXX\AppData\Local\Temp\analyze3437511062926981065.py

This operation throws the following error.

The error could be fixed by changing the ‘rb’ to ‘rt’ in the following code.

f = open(‘.\Temp\knime2python4984166066799568347.csv’, ‘rb’)

But I can’t find where this kind of code is in the node script editor.

I am a bit confused. Does this temp-file really contain this line?

Which KNIME-version do you use and which version of the Python Scripting plugin?

1 Like

Would it be possible to create a minimum example showing these symptoms so we might investigate further. Which Python community nodes are you using and with which functions.

Could it be an option to use the non-community nodes and Python 3.x? (sorry if I missed an information from the thread)

Sorry for confusing you. @niederle
That temp-file does’t really contain the line.
I think the error could be an encoding problem, so that kind of code maybe contained.

I have updated KNIME and the installed plugin to latest version.

Thanks.

And now things are fine?

Hi, @mlauber71
Thanks for your reply.

I couldn’t successfully run all the Community nodes when I posted the first thread here.
But that has already been solved 4 days ago after I changed the correct Python executable path to Python 2, by the help of replies.
Now the question is about an execution error, and yes, I think the same thing can be done by using of non-community node. ( just interested in solving the particular error)

Not yet. @niederle

Actually, I think I created the workflow in the latest KNIME and it’s plugin installed because I can update nothing when I do [update KNIME] now.