Deep Learning - Keras installation

Hi,
I am currently playing around with the the Keras nodes and tried to get an example workflow running but something seems to be wrong with my Python setup. As recommended, I used the “new environmenr” option in the Python Deep Learning preferences to create a new environment. Package versions are now:

keras - 2.2.4
tensorflow - 1.12.0
python - 3.6.9

Executing the ‘Keras Network Learner’ fails with the following error:

ERROR Keras Network Learner 2:16       Failed to save Keras deep learning network.
Traceback (most recent call last):
File "<string>", line 3, in <module>
  File "/Users/niederle/knimeInUse/knime-apps/KNIME 4.0.0.app/Contents/Eclipse/plugins/org.knime.dl.keras_4.0.0.v201906111427/py/DLKerasNetwork.py", line 235, in save
    raise RuntimeError('Failed to save Keras deep learning network.') from e
RuntimeError: Failed to save Keras deep learning network.

ERROR Keras Network Learner 2:16       Execute failed: An error occurred while creating the Keras network from its layer specifications.
This could be due to a version mismatch between Keras and TensorFlow.
Please make sure that Keras 2.1.6 and TensorFlow 1.8.0 are installed in your Python environment.
See log for details.
You can install the correct version of Keras and TensorFlow on the 'Python Deep Learning' preference page.

I will now try to downgrade Keras and Tensorflow to the suggested versions and see whether that helps. Any other ideas?

Hi @niederle,

generally both keras - 2.2.4 with tensorflow - 1.12.0 and keras - 2.1.6 with tensorflow - 1.8.0 should work. Could you maybe attach the full log file and an example workflow?

Cheers,
David

Hi David,

here is the knime.log (11.8 KB)
(I deleted the log-file before restarting KNIME - so it’s pretty short).

The (example-)workflow: Building CNN from scratch with Keras Layer nodes.knwf

Best,
Antje

I guess, I found the solution today. It has nothing to do with my setup. As I said, I imported this workflow (which is already executed) and only reset the ‘Keras Network Learner’ before trying to execute it again.
As I could successfully execute another example workflow (“03_Train_MNIST_classifier”), I thought it has something to do with the network and tried to compare. As the ‘Keras Writer’ also failed, I tried to export the network with the model writer which gave me the following error:

Execute failed: Failed copying file stores to local handler

Finally, I tried to also reset and reexecute the predecessor Keras node (which is a ‘Keras Dense Layer’) and now things work!

I hope this will help to fix this example workflow (or the node) as I assume that such problems should not occur. Beside that, the Keras error message is pretty misleading - maybe things could be improved there. I spent a lot of troubleshooting with my Keras/Python setup which was not a problem at all…

Best,
Antje

4 Likes

Hi @niederle,

thanks for reporting the issue and your progress. I opened a bug ticket.

Cheers,
David

Hi,

I’m having the same issue. I have already installed keras= 2.1.6 and tensorflow=1.8.0 but keep getting the error telling:

Execute failed: An error occurred while creating the Keras network from its layer specifications.
This could be due to a version mismatch between Keras and TensorFlow.
Please make sure that Keras 2.1.6 and TensorFlow 1.8.0 are installed in your Python environment.
See log for details.

Here is the log file data related to the session in which the error occurred:

!SESSION 2021-04-23 23:43:05.993 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.8.0_252
java.vendor=AdoptOpenJDK
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Command-line arguments:  -os win32 -ws win32 -arch x86_64

!ENTRY org.eclipse.jface 2 0 2021-04-23 23:43:10.430
!MESSAGE Keybinding conflicts occurred.  They may interfere with normal accelerator operation.
!SUBENTRY 1 org.eclipse.jface 2 0 2021-04-23 23:43:10.430
!MESSAGE A conflict occurred for CTRL+F:
Binding(CTRL+F,
	ParameterizedCommand(Command(org.eclipse.ui.edit.findReplace,Find and Replace,
		Find and replace text,
		Category(org.eclipse.ui.category.edit,Edit,null,true),
		org.eclipse.ui.internal.WorkbenchHandlerServiceHandler@66682e8f,
		,,true),null),
	org.eclipse.ui.defaultAcceleratorConfiguration,
	org.eclipse.ui.contexts.window,,,system)
Binding(CTRL+F,
	ParameterizedCommand(Command(knime.commands.findnode,Find Node...,
		Finds a Node in the workflow.,
		Category(knime.command.category,KNIME Workflow Editor commands,Commands available for the workflow editor,true),
		org.eclipse.ui.internal.WorkbenchHandlerServiceHandler@2d2af12e,
		,,true),null),
	org.eclipse.ui.defaultAcceleratorConfiguration,
	org.eclipse.ui.contexts.window,,,system)

!ENTRY org.eclipse.equinox.p2.core 4 0 2021-04-23 23:43:13.239
!MESSAGE Exception during event notification
!STACK 0
java.lang.IllegalArgumentException: Location must be absolute: ..
	at org.eclipse.equinox.internal.p2.repository.helpers.AbstractRepositoryManager.checkValidLocation(AbstractRepositoryManager.java:756)
	at org.eclipse.equinox.internal.p2.repository.helpers.AbstractRepositoryManager.contains(AbstractRepositoryManager.java:252)
	at org.eclipse.equinox.internal.p2.repository.helpers.AbstractRepositoryManager.addRepository(AbstractRepositoryManager.java:167)
	at org.eclipse.equinox.internal.p2.repository.helpers.AbstractRepositoryManager.notify(AbstractRepositoryManager.java:825)
	at org.eclipse.equinox.internal.p2.core.ProvisioningEventBus.dispatchEvent(ProvisioningEventBus.java:103)
	at org.eclipse.equinox.internal.p2.core.ProvisioningEventBus.dispatchEvent(ProvisioningEventBus.java:1)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234)
	at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:345)

!ENTRY org.eclipse.equinox.p2.core 4 0 2021-04-23 23:43:13.240
!MESSAGE Exception during event notification
!STACK 0
java.lang.IllegalArgumentException: Location must be absolute: ..
	at org.eclipse.equinox.internal.p2.repository.helpers.AbstractRepositoryManager.checkValidLocation(AbstractRepositoryManager.java:756)
	at org.eclipse.equinox.internal.p2.repository.helpers.AbstractRepositoryManager.contains(AbstractRepositoryManager.java:252)
	at org.eclipse.equinox.internal.p2.repository.helpers.AbstractRepositoryManager.addRepository(AbstractRepositoryManager.java:167)
	at org.eclipse.equinox.internal.p2.repository.helpers.AbstractRepositoryManager.notify(AbstractRepositoryManager.java:825)
	at org.eclipse.equinox.internal.p2.core.ProvisioningEventBus.dispatchEvent(ProvisioningEventBus.java:103)
	at org.eclipse.equinox.internal.p2.core.ProvisioningEventBus.dispatchEvent(ProvisioningEventBus.java:1)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234)
	at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:345)

Any thoughts?

Hi @behrooz12,

Could you please also upload your knime.log file? (The one you uploaded should be the .log file, I believe.) You can find the file at <your-knime-workspace>/.metadata/knime/knime.log or via View > Open KNIME Log inside KNIME Analytics Platform.

Marcel

Hi Marcel,

I have attached the knime.log file. Please let me know if you need any additional information.

Best,
Behrooz
knime.log (3.0 MB)

Hi Behrooz,

I believe in your case, the printed error message that complains about mismatching Keras and TensorFlow versions is, again, misleading. Digging through the log file brings up this line that should be the more likely cause of the error:

AttributeError: ‘DataFrame’ object has no attribute ‘convert_objects’

This is an error message thrown when using versions of pandas that are more recent than the one supported by our deep learning integration. The integration still relies on a fairly old version of pandas (version 0.23). We plan to upgrade that version in the future, but for the time being, could you try to downgrade your pandas package to v0.23, restart KNIME if necessary, and retry?

Marcel

2 Likes

Thanks Marcel. I don’t have access to my computer right now to try your suggested solution. But I believe the pandas version installed on my Python is the most recent version. I will downgrade that and let you know the outcome.

Best
Behrooz

Hi Marcel,

Just wanted to let you know that your solution worked. Thanks a lot for your help.

Best,
Behrooz

2 Likes

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