I just want to share something I struggled with before.
If you want to implement Python code in KNIME, the latter needs to read your environment, so you can import the libraries to work with.
Although there is a guide how to do it, it consists of so many steps, I just felt unnecessarily complicated. So here’s my quick guide how to use Python in KNIME (v. 3 only):
-
Install Anaconda - it takes care of your environment, to ensure that different libraries which depend on each other are compatible. download
-
Open your KNIME preferences, go to KNIME > Python and find your distribution path. In my case this is C:\ProgramData\Anaconda3 (on Win10x64). Choose your environment to be “base” and wait for it to be initialized (collected and tested).
-
Start playing with Python:
You can define a variable to use in the code, so you can control multiple objects with one, as shown in the picture. You can play with the data frame as you wish, and importing and exporting the data is easy with double-clicking all the way. Note that there is probably a convention of in / out data table to be named as input_table and output_table.
While I’m not too advanced with Python, and haven’t run too complex flows with KNIME, this guide may be a good starting point of comprehending how the two software packages can work together.
Cheers all!
Julian