Knime Server Python Import Error

I am receiving the following error when I am trying to access my knime workflow deployed on knime server via ReST API.

“Execute failed: Traceback (most recent call last):\n File “/opt/knime-full_3.5.2/plugins/org.knime.python2_3.5.0.v201712011355/py/PythonKernel.py”, line 491, in execute\n exec(source_code, self._exec_env, self._exec_env)\n File “”, line 17, in \nImportError: No module named ‘sklearn’\n”

The knime server is hosted on AWS EC2, I accessed the server through SSH, installed the module via pip, and verified the installation by importing the library to python console and everything worked fine. I am assuming it is not using the system default python, need help configuring the same. Thank you.

Hi there,

On the EC2 instance, please check the file contents of /srv/knime_server/config/preferences.epf.

There should be lines like:
/instance/org.knime.python2/defaultPythonOption=python3
/instance/org.knime.python2/python3Path=/home/knime/python/python35.sh

The commands in: /home/knime/python/python35.sh
activate the conda environment like: source /home/knime/python/anaconda/bin/activate py35_knime

So you’ll need to make sure that you install sklearn into that environment. Something like:
source /home/knime/python/anaconda/bin/activate py35_knime
conda install -c anaconda scikit-learn

Alternatively (but not recommended) you may choose to change the path in /instance/org.knime.python2/python3Path= to point to the system python, where you install sklearn already.

Best,

Jon

Thank you Jon, that did solve the problem I was facing. However, I would like to mention that I am trying to access the workflow using rest api, most of the rest end points work, but when I make a post request to initiate a new job, I am getting the following error,
KNIME Slave 4.7.2 is not compatible with KNIME Server 4.6.1

Hi there,

In this case it looks like the executor is updated ahead of the KNIME Server. You have three options.

  1. Update the KNIME Server to 4.7.3 (latest version). See details here: https://download.knime.com/server/4.7/KNIME_Server_Release_Notes_Update_Guide_4.7.pdf
  2. Revert the executor to 3.5.x. If you have a backup that is easy.
  3. Uninstall the 4.7.2 slave feature group, and install the 4.6.1 slave feature group. See details in: https://download.knime.com/server/4.7/KNIME_Server_Administration_Guide_4.7.pdf (around page 18)

Drop me a DM if you don’t have access to the software download pages.

Best,

Jon

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