How to install python in local host via docker

according to n8n Docs :slight_smile:

To get Python available in your local n8n instance running via Docker, you typically extend the official n8n image and install Python inside it, then run that custom image locally.

1. Create a Dockerfile that adds Python

Create a file named Dockerfile in an empty folder:

FROM docker.n8n.io/n8nio/n8n:latest

# Install Python and pip in the Alpine-based n8n image
USER root
RUN apk add --no-cache python3 py3-pip
USER node

This follows the same pattern used in community solutions where Python is added to the n8n container via apk add python3 py3-pip on Alpine-based images. [Can’t set up Whisper; Hostinger + Python]

2. Build the custom image

From the same folder as the Dockerfile:

docker build -t n8n-python .

3. Run n8n with the new image on localhost

Use the usual n8n Docker run command, but reference your new image:

docker volume create n8n_data

docker run -it --rm \
  --name n8n \
  -p 5678:5678 \
  -e GENERIC_TIMEZONE="Europe/Berlin" \
  -e TZ="Europe/Berlin" \
  -e N8N_ENFORCE_SETTINGS_FILE_PERMISSIONS=true \
  -e N8N_RUNNERS_ENABLED=true \
  -v n8n_data:/home/node/.n8n \
  n8n-python

This is the same pattern the docs use to start n8n locally with Docker, just pointing to your custom image instead of the stock one. [Docker installation]

After this, Python will be available inside the n8n container (for example to use from Execute Command, or for tools that rely on a system Python).