Blocked for security reasons at PythonSandbox.getPrettyError

Describe the problem/error/question

When using Python in a Code node, directly importing micropip will cause an error.

What is the error message (if any)?

Node type

n8n-nodes-base.code

Node version

2 (Latest)

n8n version

1.107.3 (Self Hosted)

Stack trace

Error: RuntimeError: Blocked for security reasons at PythonSandbox.getPrettyError (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-nodes-base@file+packages+nodes-base_@[email protected]_asn1.js@5_1af219c3f47f2a1223ec4ccec249a974/node_modules/n8n-nodes-base/nodes/Code/PythonSandbox.ts:101:11) at PythonSandbox.runCodeInPython (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-nodes-base@file+packages+nodes-base_@[email protected]_asn1.js@5_1af219c3f47f2a1223ec4ccec249a974/node_modules/n8n-nodes-base/nodes/Code/PythonSandbox.ts:85:15) at PythonSandbox.runCodeAllItems (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-nodes-base@file+packages+nodes-base_@[email protected]_asn1.js@5_1af219c3f47f2a1223ec4ccec249a974/node_modules/n8n-nodes-base/nodes/Code/PythonSandbox.ts:46:27) at ExecuteContext.execute (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-nodes-base@file+packages+nodes-base_@[email protected]_asn1.js@5_1af219c3f47f2a1223ec4ccec249a974/node_modules/n8n-nodes-base/nodes/Code/Code.node.ts:168:14) at WorkflowExecute.runNode (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@[email protected]_@[email protected]_0c275070fd0434c00ffd62213b2bcae4/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:1212:9) at /usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@[email protected]_@[email protected]_0c275070fd0434c00ffd62213b2bcae4/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:1582:27 at /usr/local/lib/node_modules/n8n/node_modules/.pnpm/n8n-core@file+packages+core_@[email protected]_@[email protected]_0c275070fd0434c00ffd62213b2bcae4/node_modules/n8n-core/src/execution-engine/workflow-execute.ts:2158:11

Please share your workflow

Share the output returned by the last node

Information on your n8n setup

  • n8n version: 1.107.3
  • Database (default: SQLite): SQLite
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: Linux

Maybe it’s related to this commit?

hello @gq_g

You can’t import packages which are not listed in the pyodide:

Packages built in Pyodide — Version 0.28.2

1 Like

@barn4k we used to be able to import external packages thru micropip.install()

Now its throwing this error

Isnt it better to try something like adding an env variable to import specifics packages?

Just like this env but its for js

NODE_FUNCTION_ALLOW_EXTERNAL=axios,qs

NODE_FUNCTION_ALLOW_BUILTIN=*

not for the python :slight_smile:

dunno why it was so tight sandboxed

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