GCP’s tech support advised me to contact N8N regarding the Configure n8n deployment of my PostgreSQL (e.g., Create a volume for file storage, Pod resources, Environment variables) error message: Command Not Found (See captured screenshot images for details).
To configure n8n to use Postgres you will need to create a database and user in your postgres instance and set the environment variables which can be found here: Supported databases and settings | n8n Docs to let n8n know which database it is connecting to.
That doesn’t sound like an n8n setting and is more related to your GCP configuration which we don’t support. We consider self hosting n8n an advanced configuration option and a pre-req for this is the knowledge to manage the environment you are planning to use.
In this case to actually answer the question though the data will be going from n8n to Postgres so it would be an ingress rule on your database and an egress rule for your n8n instance. I would strongly recommend getting in touch with someone who can help you set up your Google environment as if you configure it incorrectly you may potentially leave your data at risk
I will run the n8n Google Docker installation, which is different from the n8n Google Kubernetes installation. My use case is to install an n8n Python module node. Please see the attached screenshot of the n8n cloud workflow error message.
Can you share the actual workflow so we can see what you are doing? That error looks like you are trying to use n8n as a module which doesn’t exist, It is also important to note that when using Python in n8n you are limited to the pyodide packages.
It looks like you are trying to import from n8n which doesn’t exist. You can find a bit more information about the Python support and the packages supported here: Code node | n8n Docs
Does the error message (Error: ModuleNotFoundError: No module named ‘n8n’) refer to either:
(1) External libraries#
If you self-host n8n, you can import and use built-in and external npm modules in the Code node. To learn how to enable external modules, refer the Configuration guide.
(2) Built-in methods and variables#
n8n provides built-in methods and variables for working with data and accessing n8n data. Refer to Built-in methods and variables for more information.
The syntax to use the built-in methods and variables is _variableName or _methodName(). Type _ in the Code node to see a list of suggested methods and variables.
Are these local directory modules available on the n8n online version(External libraries#, Built-in methods and variables#) :
at PythonSandbox.getPrettyError (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Code/PythonSandbox.js:69:20)
at PythonSandbox.runCodeInPython (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Code/PythonSandbox.js:56:24)
at PythonSandbox.runCodeEachItem (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Code/PythonSandbox.js:26:33)
at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Code/Code.node.js:134:26)
at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/Workflow.js:670:19)
at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:652:53
Does the error message (Error: ModuleNotFoundError: No module named ‘n8n’) refer to either:
This is what I mentioned previously, There is no python module called n8n that you can import anything from so if you were doing something like from n8n.core.node_context import NodeContext I would expect it to fail. Out of interest where did you see this documented?
The paths in your second part are from the error and point to code paths for where the issue is coming from, These are not directories you would access and they are javascript files not python so would likely not make that much of a difference.
The Code node does support Python but you are trying to use a package that doesn’t exist which is why you are seeing the error. Self hosting could be an option but if you try running the code you are using now it will still fail.