hard time running sklearn libraries in python script

Hi there,

After comparing error on hold out set in python (sklearn) vs. knime for random forest regressor ensemble, I get a much smllar error on sklearn.

However, I want to keep the flexibility of using a KNIME workflow. I am thus doing all data manipulation in knime, and when it comes to learning and prediction, I plan to resort to sklearn.

However, I get the following error whenever I call on any of the sklearn classes. I am really sorry for the long message.

Has anyone come across this problem?

Thanks.

Best,

Alejandro

 

ERROR Python Script        0:160      Execute failed: Message missing required fields: output, error
ERROR PythonKernel                    Traceback (most recent call last):
  File "C:\Program Files\KNIME\plugins\org.knime.python_3.1.2.v201603040957\py\PythonKernel.py", line 1044, in <module>
    run()
  File "C:\Program Files\KNIME\plugins\org.knime.python_3.1.2.v201603040957\py\PythonKernel.py", line 104, in run
    execute_response.output, execute_response.error = execute(command.execute.sourceCode)
  File "C:\Users\Alejandro\Anaconda2\lib\site-packages\google\protobuf\internal\python_message.py", line 471, in field_setter
    self._fields[field] = type_checker.CheckValue(new_value)
  File "C:\Users\Alejandro\Anaconda2\lib\site-packages\google\protobuf\internal\type_checkers.py", line 166, in CheckValue
    (proposed_value))
ValueError: 'Traceback (most recent call last):\n  File "C:\\Program Files\\KNIME\\plugins\\org.knime.python_3.1.2.v201603040957\\py\\PythonKernel.py", line 282, in execute\n    exec(source_code, _exec_env, _exec_env)\n  File "<string>", line 5, in <module>\n  File "C:\\Users\\Alejandro\\Anaconda2\\lib\\site-packages\\sklearn\\__init__.py", line 57, in <module>\n    from .base import clone\n  File "C:\\Users\\Alejandro\\Anaconda2\\lib\\site-packages\\sklearn\\base.py", line 9, in <module>\n    from scipy import sparse\n  File "C:\\Users\\Alejandro\\Anaconda2\\lib\\site-packages\\scipy\\sparse\\__init__.py", line 213, in <module>\n    from .csr import *\n  File "C:\\Users\\Alejandro\\Anaconda2\\lib\\site-packages\\scipy\\sparse\\csr.py", line 13, in <module>\n    from ._sparsetools import csr_tocsc, csr_tobsr, csr_count_blocks, \\\nImportError: DLL load failed: %1 n\xe3o \xe9 um aplicativo Win32 v\xe1lido.\n' has type bytes, but isn't in 7-bit ASCII encoding. Non-ASCII strings must be converted to unicode objects before being added.

Hi Alejandro,

Did you manage to import the sklearn packages when running the same Python interactively (externally from KNIME)?

Best,

Jon

Check out my post about how to use Python in KNIME (for dummies).

Needs Anaconda installation.

2 Likes