Hi @itsalanlee, n8n’s Python implementation only supports packages compatible with Pyodide as documented here I am afraid. pydub
is unfortunately not on the list.
You could, however, use Python (or FFmpeg’s binaries) through the Execute Command node. Seeing you’re using docker you’d need to build a custom image for these tools to be available, but it’s not too much work.
Your Dockerfile
could look like so (this will install python3, ffmpeg, curl and a few example Python packages using pip):
# Use the original n8n image as the basis
FROM n8nio/n8n:ai-beta
# Install additional packages as needed
USER root
ENV PYTHONUNBUFFERED=1
RUN apk add --update --no-cache python3 curl ffmpeg
RUN python3 -m ensurepip
RUN pip3 install --no-cache --upgrade pip setuptools speedtest-cli
USER node
Assuming you’re also using docker-compose, you’d also need to specify the build action in your docker-compose.yml
file. If both Dockerfile
and docker-compose.yml
live in the same directory, the docker-compose.yml file itself can as simple as this:
services:
n8n:
build: .
restart: unless-stopped
ports:
- 5678:5678
volumes:
- ./data:/home/node/.n8n
Finally, build n8n using docker pull n8nio/n8n:ai-beta && docker compose build
and start it using docker compose up --detach
.
Afterwards you can use ffmpeg
or python
(or any other package you might install of course) right through the Execute Command node in n8n:
Hope this helps!