PythonFunction node not finding executable path

Describe the problem/error/question

I’m trying to run Python functions but can’t seem to get n8n to find the executable.

What is the error message (if any)?

NodeOperationError: exitCode: 0 spawn python3 ENOENT
    at Object.execute (/home/node/.n8n/nodes/node_modules/n8n-nodes-python/nodes/PythonFunction/PythonFunction.node.ts:107:11)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Workflow.js:652:28)
    at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:596:53

Please share your workflow

Just testing the PythonFunction node

Things I’ve done:
Installed Python3 successfully (located in /usr/bin/python3)
Installed relevant packages
Updated the PATH for my n8n user (which has admin privileges) to ensure /usr/bin/python3 is ahead of my local bin
Confirmed that the folder for python is correctly prioritized in $PATH
Updated the .env variable to be PYTHON_PATH=/usr/bin/python3
Restarted n8n several times
Removed and added back in the Python node

When that didn’t work - I added the python path to my local .env file, that didn’t work either

Information on your n8n setup

n8n version: 0.231.3
Docker n8n on SSL hosted website

Hey @Pieter_Block,

Are you using our v2 code node which has python support or the python community node? It looks like you are using the community node which is not something we support here and you would need to chat to whoever created it.

If you wanted to try out our Python option you can find out how to use it here: Python Support and Release Versions

I grabbed the node code, updated the typeVersion to “2” - but when trying to run it, I’m stuck in a endless run

Does this mean there’s an issue with my python installation?

Hey @Pieter_Block,

If you are using our code node there is no need for python to be installed in the container. That looks like you might just need to do a reload on the page and try again.

It looks like your code does actually not return anything (no return). A print does not get returned from by node, but the output is rather displayed in the browser console, as mentioned underneath the editor.

Also important to mention is that the node uses pyodide, which does not give access to the file system. It will pretend to do so (think it creates kind of a fake one) but it is not the actual one. Generally, is the node meant to work with data from the workflow with Python rather than loading data via Python from the file system.

Thank you for pointing that out - I do not have any lot of experience with pyodide, learning experience for me!

1 Like

Happy to hear that it was helpful!
Sure, I am also quite new to pyodide.
Have fun!

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