Error using Keras

Hi. I am trying to run example 05_Neural_Machine_Translation, with Keras on top of Python 3.6.5 (Anaconda). Already tried both GPU and CPU versions. Keras and dependencies are installed.

Thanks in advance!

ERROR DL Python Network Creator 0:14       Execute failed: Traceback (most recent call last):
  File "C:\Program Files\KNIME\plugins\org.knime.dl.keras_3.6.0.v201807091039\py\DLKerasNetwork.py", line 207, in save
    self._model.save(path)
  File "C:\Users\flopez\Anaconda3\lib\site-packages\keras\engine\topology.py", line 2591, in save
    save_model(self, filepath, overwrite, include_optimizer)
  File "C:\Users\flopez\Anaconda3\lib\site-packages\keras\models.py", line 134, in save_model
    topology.save_weights_to_hdf5_group(model_weights_group, model_layers)
  File "C:\Users\flopez\Anaconda3\lib\site-packages\keras\engine\topology.py", line 2962, in save_weights_to_hdf5_group
    weight_values = K.batch_get_value(symbolic_weights)
  File "C:\Users\flopez\Anaconda3\lib\site-packages\keras\backend\tensorflow_backend.py", line 2327, in batch_get_value
    return get_session().run(ops)
  File "C:\Users\flopez\Anaconda3\lib\site-packages\keras\backend\tensorflow_backend.py", line 180, in get_session
    _SESSION = tf.Session(config=config)
  File "C:\Users\flopez\Anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 1494, in __init__
    super(Session, self).__init__(target, graph, config=config)
  File "C:\Users\flopez\Anaconda3\lib\site-packages\tensorflow\python\client\session.py", line 626, in __init__
    self._session = tf_session.TF_NewSession(self._graph._c_graph, opts)
tensorflow.python.framework.errors_impl.InternalError: Failed to create session.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Program Files\KNIME\plugins\org.knime.python2_3.6.0.v201807061638\py\PythonKernelBase.py", line 278, in execute
    exec(source_code, self._exec_env, self._exec_env)
  File "<string>", line 3, in <module>
  File "C:\Program Files\KNIME\plugins\org.knime.dl.keras_3.6.0.v201807091039\py\DLKerasNetwork.py", line 209, in save
    raise RuntimeError('Failed to save Keras deep learning network.') from e
RuntimeError: Failed to save Keras deep learning network.

Hi peleitor,

Could you please provide us with the list of installed packages in your conda environment? That would help us find any version mismatches of Keras and its dependencies. You can do that via
conda list -n py35_knime
where “py35_knime” is the name of your conda environment.
Also, what version of KNIME are you running?

Marcel

I am using KNIME 3.6.0.

You can find attached the list of packages.

I have only one environment in Anaconda. Do I need to create one new specifically for KNIME? If so, how do I specify this new enviromnent to KNIME?

packages.txt (17.1 KB)

Thanks!

I’m not sure if it’s a good idea to have both keras and keras-gpu (tensorflow and tensorflow-gpu) installed in the same environment.
Could you please uninstall the GPU version of both first? (You can add them back later, of course, but I think getting the CPU version to run is easier for starters.) You can do that via:
conda uninstall -n py35_knime keras-gpu tensorflow-gpu
where, again, “py35_knime” is the name of your conda environment.

If the problem persists, please downgrade TensorFlow to version 1.8.0:
conda install -n py35_knime tensorflow=1.8.0

If you got the CPU version to run, you can try and remove keras and tensorflow and install keras-gpu and tensorflow-gpu (I’d also recommend version 1.8.0 here).

If the CPU version worked and the GPU version does not, it’s most likely an issue with CUDA/cuDNN. Please make sure you followed the setup steps mentioned here.

Hi peleitor and marcel,

Good suggestions @MarcelW, but I think you meant TensorFlow 1.8.0, not 0.8.0. Right?

Oops, yes, thanks! I’ll edit it.