Improving Python functionanity

I believe that Python can unlock potential usages and ease workflow developments for new coders.

I began coding using Python, and got into automating processes mainly involving tabular data (databases, excel or csv files, google sheets, and PDFs)

If we could use python inside n8n, just like an IDE (i mean easy installs and imports of packages and modules) we could simplify lots of automations, and help a segment of users to better and faster understanding of code nodes (for those that are not profficient in javascript).

Besides better understanding of code faster, it would be great to test all the different kinds of package and module usage. The potential could be limitless (pandas, polars, deterministic narrow ai usage, and many other practical packages)

Pandas, Numpy and Datetime are my main packages for tabular data processing.

Hey @Sebastian_Arias, while you wait for a response, here are some things that might help:

Suggested resources

Automatically matched to your question.

Docs:

Forum:

@MehranZ, @QSergi - you’ve helped with similar issues before, can you take a look?

Automatically suggested by n8n’s community bot. It’s a pilot - please share feedback here.

@Sebastian_Arias You’re not starting from zero — Code nodes already run Python, and on self-hosted you can get much closer to “IDE-like” packages via task runners.

What works today:

  1. Code node → Language: Python for small transforms (Pyodide / runner depending on version). Fine for datetime and light logic; not a full pandas IDE on Cloud.
  2. Self-hosted task runners for real packages (pandas, numpy, etc.): enable external runners and add extras in the runner image / documented “extra dependencies” path (see Task runners docs). That is the supported way to import pandas without hacking the main n8n container.
  3. Heavy tabular work many people keep outside the Code node: CSV/Sheets → HTTP Request calling a small FastAPI/Flask with pandas, or a dedicated Python container. Keeps n8n as orchestration.

Minimal pattern that scales better than stuffing everything into one Code node:

# sidecar sketch — pip install pandas flask
import pandas as pd
from flask import Flask, request, jsonify

app = Flask(__name__)

@app.post("/transform")
def transform():
    rows = request.json["rows"]
    df = pd.DataFrame(rows)
    # ... pandas work ...
    return jsonify(df.to_dict(orient="records"))

Then HTTP Request from n8n. On Cloud you will not get arbitrary pip install inside Code; vote the feature and use a sidecar or Sheets/DB nodes for tabular work until runners are available on your plan.

If you say Cloud vs self-hosted + version, I can narrow to the exact Code vs runner path for your setup.

2 Likes

Thanks for you reply Max, I appreciate it.

What I want to promote is the idea of a “Plug and play” method for Python-first users. Having workarounds outside n8n when coding, gives the process a lot of friction.

To be clear, I do use n8n as orchestration tool as well on many occasions, but it would be great to be able to simply do it all in there. The whole system becomes less coupled, and you don’t have to jump from app to app and using complex directories for executing specific files of code.

Cheers

Hi @Sebastian_Arias, good news: part of this already exists.

The Code node has a Python mode (Language → Python). On recent n8n versions it runs native Python through task runners, so it’s real Python, not a JavaScript shim.

What you can use depends on where n8n runs:

  • n8n Cloud: Python standard library only (e.g. datetime, json, re, csv). No pandas/numpy.
  • Self-hosted: you can add packages like pandas. Run the task runner in external mode (the n8nio/runners image), build a small custom image that installs your packages, and allow them in the runner config (stdlib/external allow lists). The “Task runners” docs page the bot linked covers the exact settings.

Tip for tabular work until then: many CSV / Sheets jobs work fine with the built-in nodes (Extract from File, Aggregate, Summarize, Remove Duplicates) plus a small Code node only for the custom maths.

Hey Ahmad, thanks for the reply.

I use self-hosted, and have a custom docker image for python use.

However, I believe n8n should make Python coding more “plug and play”.

At this time, to be able to use python, you must do a big workaround. I believe it shouldn’t be more complicated than a normal pip-install and then just import the packages on the code node.

Hope this gives you enough information to express my need/friction.

Cheers