Python Native Beta

Question: Python Native Runtime and import Limitations after Upgrade

Hi everyone,

I’ve successfully upgraded to n8n version > 1.113.2, which includes the Python Native Runtime and the new Data Table feature. However, I’ve noticed that I still cannot use import statements inside the Python node.

So, I’m wondering:

  • Did I miss some configuration step?
  • Or is n8n currently restricting import usage for security reasons, as mentioned in the documentation?

Additionally, once this limitation is lifted, will it be possible to:

  • Run pip install <library> inside the Execute Command node,
  • And then use that library (e.g., selenium or playwright) directly inside a Python node for web automation or simulation tasks?

Thanks a lot for the amazing work - I’m really excited about the new Python native support and can’t wait to explore more advanced use cases!

Information on your n8n setup

  • n8n version: 1.114.3
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: Window
3 Likes

I encountered the same question.
I try to modify /etc/n8n-task-runners.json like this:
“N8N_RUNNERS_STDLIB_ALLOW”: “os,sys”,
“N8N_RUNNERS_EXTERNAL_ALLOW”: “pandas,openpyxl”

but it doesn’t work.

Same here, still waiting for the update to fix things or instruction.

Same here.
I hope they fix - or give instructions - about this issue soon.

I would also appreciate instructions on how to allow specific Python packages in the n8n hosted environment (I’m not sure I have access to modify env vars when n8n hosts).

2 Likes

This worked for me for self hosted -

I’ve got these 4 files in my directory:

docker-compose.yml

services:
  n8n:
    image: n8nio/n8n:1.111.0
    container_name: n8n-main
    environment:
      - N8N_RUNNERS_ENABLED=true
      - N8N_RUNNERS_MODE=external
      - N8N_RUNNERS_BROKER_LISTEN_ADDRESS=0.0.0.0
      - N8N_RUNNERS_AUTH_TOKEN=your-secret-here
      - N8N_NATIVE_PYTHON_RUNNER=true
    ports:
      - "5678:5678"
    volumes:
      - n8n_data:/home/node/.n8n

  task-runners:
    image: n8n-runner:custom
    container_name: n8n-runners
    environment:
      - N8N_RUNNERS_TASK_BROKER_URI=http://n8n-main:5679
      - N8N_RUNNERS_AUTH_TOKEN=your-secret-here

    # critical for overriding allowed deps
    volumes:
      - ./n8n-task-runners.json:/etc/n8n-task-runners.json

    depends_on:
      - n8n

volumes:
  n8n_data:

n8n-task-runners.json
copy from:
https://github.com/n8n-io/n8n/blob/master/docker/images/runners/n8n-task-runners.json
and edit the list of allowed libs in the bottom

“N8N_RUNNERS_STDLIB_ALLOW”: “”,

“N8N_RUNNERS_EXTERNAL_ALLOW”: “”

extras.txt:

# like a requirements.txt 
# pypdf==4.2.0

Task Runner dockerfile:

FROM n8nio/runners:1.111.0

COPY extras.txt /app/task-runner-python/extras.txt

RUN set -e; \
    PY_BIN="/opt/runners/task-runner-python/.venv/bin/python"; \
    if [ ! -x "$
PY_BIN
" ]; then PY_BIN="$(command -v python3)"; fi; \
    "$PY_BIN" -m ensurepip --upgrade; \
    "$PY_BIN" -m pip install --no-cache-dir -r /app/task-runner-python/extras.txt

When in directory containing all files:

1. docker build -t n8n-runner:custom
2. docker compose up

That should basically be it. Now you can use those extra libs in a native python code node.

2 Likes

At this point, I’ve spend over four nights getting external python libraries to work. However, it still doesn’t. For some reason the mentioned solution in this post won’t work for me. I hope the n8n team can make this process a lot easier (e.g. through env vars) in one of the coming builds.

1 Like

I’m not sure how to tag the n8n team to notice the requests here, but I am posting this to keep this conversation alive as well.
Getting strong python support for both self-hosted and n8n hosted is very powerful, but we need ways to securely manage both types of environments to keep python going.