Just wanted to add on 1 issue i encountered while building the dockerfile,
I got:
ERROR: Unable to lock database: Permission denied
ERROR: Failed to open apk database: Permission denied
to get around it, i modified the dockerfile to
FROM n8nio/n8n
USER root
RUN apk add --update python3 py3-pip
USER root will make sure the container was run as root and allโs well.
# Use the official n8n image as the base
FROM docker.n8n.io/n8nio/n8n:latest AS base
# this ๐๐๐๐๐
USER root
RUN apk add --no-cache python3 py3-pip && \
python3 -m pip install --break-system-packages pipx
USER node
# ...
And now I can run whatever python package right from Execute Command node:
pipx run <python package>
E.g.
pipx run httpie https://example.com
No need to manually install packages. The only package needed is pipx.
For anyone having difficulties setting up python in n8n, I just made a step-by-step video tutorial showing you how to set up python, pip and pipx inside of your n8n Docker container so you can run python scripts and apps.