Can't set up Whisper or Python locally

Problem:

I need to create a workflow in N8N (self-hosted in Docker) that transcribes audio files and sends the transcriptions to a vector store. I want it to be done locally, without the OpenAI nodes.
But I can’t figure out how to install Whisper or Python anywhere. Dockerfiles are too complicated, and all attempts to install it in Docker’s “exec” thing doesn’t work, either because of these two errors:

~ $  apk update && sudo apk install python3 -y
ERROR: Unable to lock database: Permission denied
ERROR: Failed to open apk database: Permission denied

~ $ exec -it n888n bash
/bin/sh: exec: illegal option -i

This would’ve been much easier if N8N already comes with Whisper pre-installed without the need for OpenAI, as in locally.

Workflow (if it helps):

Information on your n8n setup

  • n8n version: 1.76.1 (Self-Hosted)
  • Database (default: SQLite): SQLite
  • n8n EXECUTIONS_PROCESS setting (default: own, main): default
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: Windows 10 (Alpine in Docker itself)

I would not reomend doing this without knowing what you are doing,
To add Whisper and Python to your n8n Docker setup:

  1. Create a custom Dockerfile:
FROM n8nio/n8n:latest
USER root
RUN apk add --no-cache python3 py3-pip
RUN pip3 install openai-whisper
USER node
  1. Build and run your custom image:
docker build -t custom-n8n .
docker run -it --rm --name n8n -p 5678:5678 custom-n8n
  1. Use the Python3 node in n8n to run Whisper:
import whisper

model = whisper.load_model("base")
result = model.transcribe("path/to/audio.mp3")
print(result["text"])

This approach keeps Whisper local and avoids OpenAI API usage.

If my solution helps solve your problem, please consider marking it as the answer! A like would make my day if you found it helpful! :blush::whale:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.