How to execute python in knime

Im trying to execute this code in python script node and getting error
How to execute this
Python is 32Bit
Please can some one help in this

Hi shivanisrivarshini,

You have to install module “nltk” in your local Python environment.
Assuming you’re using conda (as described in our blog post), this can be done using this command via the terminal:
conda install -n py35_knime nltk
where “py35_knime” is the name of your conda environment.

Marcel

Already installed NLTK and stanford parser in python

Do you use the same Python environment/executable in KNIME as in the command line? You can check the path via File > Preferences > KNIME > Python. Please also make sure you’re using Python 3 in KNIME.

Now its getting executed but getting this error

ERROR PythonKernel LookupError: No serializer extension having the id or processing python type “tuple” could be found.
ERROR Python Script (1⇒1) 0:1925 Execute failed: An exception occured while running the python kernel. See console and log for details.

See this post for suggested work around:

Knime does not currently support all numpy.dtypes.

1 Like

In this case, the issue may not directly be related to numpy, but is pretty similar.
At the moment, KNIME does not support Python tuples inside single cells of a DataFrame. You could try to convert each tuple into a list (given the tuples only contain elements of the same type) as lists are supported, or split the tuples into their elements and create a dedicated column for each element.

Sorry, yes, I meant to delete the last line of my post but it fell of the bottom of my screen. I need to get a bigger monitor. :slight_smile: