KNIME Deep Learning - Keras Integration

With the KNIME Deep Learning - Keras Integration, we have added a first version of our new KNIME Deep Learning framework to KNIME Labs (since version 3.5.0). Through Keras, users have access to a variety of different state-of-the-art deep learning frameworks, such as TensorFlow, CNTK, and others.


The extension contains the following nodes:

  • The DL Network Executor node for executing deep neural networks.
  • The DL Keras Network Reader node to read in pre-defined, potentially trained, Keras networks.
  • The DL Keras Network Learner node for training or fine-tuning deep neural networks within KNIME via Keras.
  • A set of nodes for flexibly creating, editing, executing, and training deep neural networks with user-supplied Python scripts.
  • More than sixty layer nodes you can use to set up your own deep network architecture without writing a single line of code (since version 3.6.0).

Screenshot layers


The KNIME Deep Learning - Keras Integration extension can be installed using the KNIME Analytics Platform Update Site where it is listed under KNIME Labs Extensions.

KNIME executes Keras in a local Python installation which has to be set up manually. We recommend setting up a conda environment as described in this blog post and restarting KNIME after that is done. Please note that the KNIME Deep Learning - Keras Integration only supports Python 3. It also requires that keras or keras-gpu be installed in the conda environment used by KNIME. Using keras (or keras-gpu) version 2.1.6 is highly recommended; however, versions between 2.0.7 and 2.1.6 should also work but are not guaranteed. Therefore, a typical command for creating a suitable conda environment could look like this for the GPU version of Keras:

conda create -y -n py35_knime python=3.5 pandas jedi keras-gpu=2.1.6

or like this for the CPU version of Keras:

conda create -y -n py35_knime python=3.5 pandas jedi keras=2.1.6

Note that keras and keras-gpu are only available as part of the standard distribution with newer conda versions (minimum conda version: 4.3.30). If you have an older version of conda, you will need to install keras and its dependencies from conda-forge (where keras-gpu is not available as a separate package).

After creating the environment and configuring the KNIME Python preferences as described, please make sure to restart KNIME. Otherwise, Keras will not be recognized as an available deep learning back end.

In case you run into problems within KNIME due to missing Keras dependencies or if you want to double-check everything was set up correctly, here is a list of the dependencies of Keras (these should have been installed automatically):

  • h5py
  • numpy (minimum version: 1.9.1)
  • pyyaml
  • scipy (minimum version: 0.14)
  • six (minimum version: 1.9.0)
  • tensorflow or tensorflow-gpu (version: 1.8.0)

You can check whether these dependencies are installed by running

conda list -n py35_knime

where py35_knime is the name of the conda environment that was created above.


KNIME Deep Learning additionally contains the following extensions:


Example workflows can be found on the public example server or in the node guide.

Known Issues

Node fails with error AttributeError: '[..]' object has no attribute 'inbound_nodes' at the bottom of a Python traceback in the KNIME log (KNIME 3.5.x only).

Keras version 2.1.3 introduced breaking changes that were adapted in KNIME version 3.6.0. Please upgrade KNIME to version 3.6.0 or downgrade Keras to version 2.1.2 or below (minimum version: 2.0.7).

Node fails with error UnicodeEncodeError: 'ascii' codec can't encode character [..] in position [..]: ordinal not in range(128) at the bottom of a Python traceback in the KNIME log.

This error may occur when using Keras version 2.1.2 to load a Keras network that was saved using an older Keras version. Make sure not to use Keras 2.1.2 in such cases.

Node fails with both an error SystemError: unknown opcode and a warning XXX lineno: [..], opcode: [..] in the KNIME log.

This is a Python related error that occurs when loading a Keras network containing a lambda expression (e.g. within a Lambda layer) that was saved using a different Python version. Make sure to use the same Python version for saving and loading the same network.

DL Keras Network Learner fails with error AttributeError: 'int' object has no attribute 'dtype' at the bottom of a Python traceback in the KNIME log when the Clip norm option is enabled in the node dialog and Keras (TensorFlow) is the selected back end.

This is a TensorFlow related error that only occurs in very specific situations. Try to use a different Keras back end to work around this issue.

DL Python Network Executor scripting node outputs wrong numerical values when using Flatbuffers serialization library.

Flatbuffers in KNIME does not support float32 data at the moment. We recommend to use Apache Arrow instead. Install it via: conda install -n py35_knime -c conda-forge pyarrow=0.7.0 , where "py35_knime" is the name of your conda environment. Then select it in KNIME via File > Preferences > KNIME > Python > Serialization library.
This will be fixed in a future version of KNIME.