Subject: Error Executing Workflow via Python Subprocess: “No module named ‘py4j’”
Dear KNIME Community,
I am encountering an issue when executing a KNIME workflow from a Python subprocess. Despite having the ‘py4j’ package installed in my configured environment, I receive the following error:
WARN KNIME-Worker-1-Python Script 3:10 DefaultPythonGateway Python standard output:
WARN KNIME-Worker-1-Python Script 3:10 DefaultPythonGateway Python standard error: Traceback (most recent call last):
File "C:\Users\mathi\AppData\Local\Programs\KNIME\plugins\org.knime.python3.scripting.nodes_5.4.0.v202411270736\src\main\python\_knime_scripting_launcher.py", line 52, in <module>
import py4j.clientserver
ModuleNotFoundError: No module named 'py4j'
Additionally, the STDERR logs include:
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
ERROR KNIME-Worker-1-Python Script 3:10 Node Execute failed: Could not connect to the Python process.
java.net.ConnectException: Could not connect to the Python process.
at org.knime.python3.DefaultPythonGateway.waitForConnection(DefaultPythonGateway.java:281)
at org.knime.python3.DefaultPythonGateway.<init>(DefaultPythonGateway.java:204)
at org.knime.python3.DefaultPythonGateway.create(DefaultPythonGateway.java:150)
at org.knime.python3.FreshPythonGatewayFactory.create(FreshPythonGatewayFactory.java:78)
at org.knime.python3.QueuedPythonGatewayFactory$PythonGatewayQueue.takeOrCreateGatewayAndEnqueue(QueuedPythonGatewayFactory.java:276)
at org.knime.python3.QueuedPythonGatewayFactory$PythonGatewayQueue.getNextGateway(QueuedPythonGatewayFactory.java:253)
at org.knime.python3.QueuedPythonGatewayFactory.create(QueuedPythonGatewayFactory.java:118)
at org.knime.python3.scripting.nodes2.PythonScriptingSession.createGateway(PythonScriptingSession.java:429)
at org.knime.python3.scripting.nodes2.PythonScriptingSession.<init>(PythonScriptingSession.java:160)
at org.knime.python3.scripting.nodes2.PythonScriptNodeModel.execute(PythonScriptNodeModel.java:179)
at org.knime.core.node.NodeModel.executeModel(NodeModel.java:596)
at org.knime.core.node.Node.invokeFullyNodeModelExecute(Node.java:1284)
at org.knime.core.node.Node.execute(Node.java:1049)
at org.knime.core.node.workflow.NativeNodeContainer.performExecuteNode(NativeNodeContainer.java:603)
at org.knime.core.node.exec.LocalNodeExecutionJob.mainExecute(LocalNodeExecutionJob.java:98)
at org.knime.core.node.workflow.NodeExecutionJob.internalRun(NodeExecutionJob.java:198)
at org.knime.core.node.workflow.NodeExecutionJob.run(NodeExecutionJob.java:117)
at org.knime.core.util.ThreadUtils$RunnableWithContextImpl.runWithContext(ThreadUtils.java:369)
at org.knime.core.util.ThreadUtils$RunnableWithContext.run(ThreadUtils.java:223)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at org.knime.core.util.ThreadPool$MyFuture.run(ThreadPool.java:123)
at org.knime.core.util.ThreadPool$Worker.run(ThreadPool.java:246)
I have verified that the ‘py4j’ package is installed in the Python environment configured within KNIME. However, the error persists, indicating that the module cannot be found during execution.
Could anyone provide insights or suggestions on how to resolve this issue?
Thank you in advance for your assistance.
Best regards