KNIME DL Python on Mac Silicon

Hi,
creating a DL Environment with KNIME on Mac Silicon is not possible. Now I wanted to solve DL Problems with DL Python Network Creator Node in KNIME instead of using Keras nodes. But the execution gives me the error:

from pandas.util.testing import network

ModuleNotFoundError: No module named ‘pandas.util.testing’

My Code inside DL Python Network Creator:

import tensorflow as tf

inputs = tf.keras.Input(shape=(4,))
x = tf.keras.layers.Dense(10)(inputs)
outputs = tf.keras.layers.Dense(1)(x)
model = tf.keras.Model(inputs, outputs)

output_network = tf.keras.Model(inputs, outputs)

Hi @mck_sbs,

it looks like some of the modules (which? please send the knime log - maybe that gives a hint) is using pandas.

In the changelog of pandas version 2.0.0, we see:

Removed pandas.util.testing in favor of pandas.testing (GH30745)

So I guess the module which uses pandas somewhere uses pandas.util.testing. Maybe you can update your module(s) hoping that a more current version uses pandas accordingly. But easier could be in you case do downgrade pandas in your Python environment to a version <2.0.0.

Does that help?

Best regards
Steffen

1 Like

Hi and thank you.

now I got this error:

ERROR DL Python Network Creator 4:1        Execute failed: Tensors are unhashable (this tensor: KerasTensor(type_spec=TensorSpec(shape=(None, 4), dtype=tf.float32, name='input_1'), name='input_1', description="created by layer 'input_1'")). Instead, use tensor.ref() as the key.
Traceback (most recent call last):
  File "<string>", line 5, in <module>
  File "/Applications/KNIME 5.1.2.app/Contents/Eclipse/plugins/org.knime.dl.python_5.1.0.v202303061416/py/DLPythonNetworkSpecToDataFrameConverter.py", line 92, in get_layer_data_specs_as_data_frames
    extractor = DLPythonNetworkSpecToDataFrameConverter(network.spec)
  File "/Applications/KNIME 5.1.2.app/Contents/Eclipse/plugins/org.knime.dl.keras_5.1.0.v202303061416/py/DLKerasNetwork.py", line 150, in spec
    self._spec = self._extract_model_spec()
  File "/Applications/KNIME 5.1.2.app/Contents/Eclipse/plugins/org.knime.dl.keras_5.1.0.v202303061416/py/DLKerasTensorFlowNetwork.py", line 87, in _extract_model_spec
    return DLKerasTensorFlowNetworkSpecExtractor(self._model).extract_spec()
  File "/Applications/KNIME 5.1.2.app/Contents/Eclipse/plugins/org.knime.dl.keras_5.1.0.v202303061416/py/DLKerasNetworkSpecExtractor.py", line 95, in extract_spec
    self._extract_node_input_tensor_specs(layer, node_idx)
  File "/Applications/KNIME 5.1.2.app/Contents/Eclipse/plugins/org.knime.dl.keras_5.1.0.v202303061416/py/DLKerasNetworkSpecExtractor.py", line 149, in _extract_node_input_tensor_specs
    if input_tensor in self._model_inputs and input_tensor not in self._visited_inputs:
  File "/Users/metinkaratas/anaconda3/envs/py38/lib/python3.8/site-packages/keras/engine/keras_tensor.py", line 268, in __hash__
    raise TypeError(
TypeError: Tensors are unhashable (this tensor: KerasTensor(type_spec=TensorSpec(shape=(None, 4), dtype=tf.float32, name='input_1'), name='input_1', description="created by layer 'input_1'")). Instead, use tensor.ref() as the key.

It is a workflow with one node

Maybe these hints in the web provide help, can you try them out?
Several suggestions:

Suggests downgrading tf:

Best regards
Steffen

PS: what did you change exactly to eliminate the first error?

@mck_sbs from my perspective there currently is no solution to run a tensorflow or Keras task with knime nodes.

1 Like

Oh, thank you. I will try with Python nodes.

1 Like