Interactive Native Python node really possible?

Hi everybody,

when we heard about the new KNIME feature to create interactive KNIME nodes based on pure Python we got really exited, since this would be the chance to overcome all the limitations of the standard view nodes and the lack of Java/Java Script developers in our institution.

However, when we ask a Python developer to recreate a simple version of the interactive KNIME Table View node as an interactive native Python node as a warm up project to get familiar with this new feature, we were informed that this is not possible in Python only and were a bit confused about that statement.

The aim is to create an interactive view node receiving a KNIME table as input, allowing the user on the KNIME Server to see the table, to search via searchbar for a string inside of the table, to select certain rows and to forward the selected rows to the node connected to the interactive Python node.

What I have learned so far is that the moment a live View is created in the front end based on the Python code/libary in the backend there is no way to send the information gathered by the user interaction back to the backend to be used later in the workflow. For that JavaScript has to be used.
Statement in short: You can create nice interactive native Python View nodes in KNIME but the information of the interaction can not be used afterwards in the following nodes.

I would like to ask KNIME and the Community to help us to further understand that topic and to may overcome it if just another library than eg. plotly has to be used.Otherwise this is a huge limitation that should be taken into account when dreaming of the new possibilities.

Many thanks in advance!
Lars

@laval concerning interactive usage in general and with Python I can offer this article and video. Also about selecting data in a dashboard and sending the results downstream.

Then I have used the Python View – KNIME Community Hub node in this node - though I am not 100% sure about the interactive part of the node itself.

Then there is this article about the new view. I plan on exploring the examples and understand what the interactive would mean and how to use that.

4 Likes

Dear @mlauber71 ,

thanks a lot for your quick answer. I went through the resources you provided. Most of these features we are using since many years on our KNIME Servers. Unfortunately, I did not find any answer on my very specific question.

I will try to rephrase it, in case it was not explained well in my introduction text above:
Is it possible to create a real interactive Python node using Python code only, forwarding the user input (eg. selecting rows of the native pure Python node to another connected node?

Table Creator → Component VIEW in KNIME Server Webportal (real interactive Python node with user interaction based on pure Python code eg. user is selecting rows in the Python-created table via checkboxes) → using forwarded selected rows in the table in any other KNIME node.

It looks like none of the interactive Python nodes have any output port at all, which would underline my new findings. I am hoping to get a very clear statement to my specific question.

Regards,
Lars

Hi Lars,

Thanks for trying to develop native Python nodes for KNIME!

Unfortunately, what you are trying to do is currently not possible. The only part where we claim interactivity of the Python nodes is that a view written in Python is not a static image anymore as in the legacy Python integration and can synchronize the selection of data points with other views in KNIME (those need not be Python-based).

This is due to the execution model of KNIME nodes in general: as soon as the execution has finished, its output must be fully available and – in the case of Python nodes – we need to be able to dispose of/reuse the Python process.

For Python view nodes this means that once the node is executed, it needs to provide an image or HTML page that represents the view. This HTML page must be self contained and currently cannot communicate in any other way with KNIME than by sharing the selection (which, e.g. in a DataApp, means that this selection resides purely within the HTML page that composes all views).

Getting back to your use case, couldn’t you use a Table View – KNIME Community Hub node for this?

Hope that helps,
Carsten

5 Likes

Thanks a lot Carsten for this clear statement.

The Table View node as Python native node was meant as a small warm up and “testing the features” project for our various ideas we had in mind what we would like to solve in native interactive Python nodes in the future, due to the fact that user interaction in the webportal is crucial for us and the views available at the moment often does not meet the specific (scientific) requirements.

Now we can adapt our ideas based on the new information.

All the best,
Lars

@laval I started taking a look at this interactive node. With an example from the hub (Sharing Component with Interactive Visualisation using Python view node with Plotly package – KNIME Community Hub). I think the ‘interactive’ part is meant for what is happening within the plotly image. You can scroll and see mouse-overs and maybe select parts and ‘interact’ with them. The results you can then capture or export from within the view, but you would I think not be able to bring results back to KNIME and continue. For that you would have to use the mentioned Reset button and other interactive elements.

Concerning exports it is possible to export the plotly images to a SVG and PNG file, then of course you would loose the interactive elements.

@carstenhaubold I am not sure if it would make sense to integrate the kaleido package in future releases, although its latest versions is from 2021 currently.

1 Like

@mlauber71 Thank you for your support and mentioning the Python View node. We will use this node if an imageoutput is needed.

The main question I had was answered by @carstenhaubold above. Our proof of concept project showed the limitations I was not aware of before and just had to be sure we are not missing something important here. Apart from that the new Python support is a great feature we will make plenty use of for sure!

Best wishes,
Lars

4 Likes

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