Step 1 — Set up an isolated environment
More detailed info below: why a venv, and why edge-tts
$ python3 -m venv .venv $ .venv/bin/pip install --upgrade pip edge-tts pydub
More detailed infoLess info
Why not just pip install edge-tts pydub? On current Debian/Ubuntu (and increasingly elsewhere), the system Python is "externally managed" — pip will refuse a global install outright:
error: externally-managed-environment × This environment is externally managed`
This isn't a bug, it's PEP 668: distro-packaged Python has OS tooling depending on specific package versions, and an unrelated pip install at the system level can quietly break that. The fix isn't the --break-system-packages flag some tutorials suggest — that just turns the warning off, it doesn't remove the actual risk. A virtual environment sidesteps the problem entirely by giving the project its own private copy of Python plus packages, isolated from the system in both directions: nothing you install can affect anything outside .venv, and nothing outside it can break what's inside. Any command below that starts with .venv/bin/... is running inside that sandbox.
Why edge-tts and not the more commonly suggested gTTS? gTTS is a thin wrapper around Google Translate's "read this aloud" button. It was never built to narrate anything — it has one flat robotic voice per language and no real options. edge-tts calls the same neural voice engine behind Microsoft Edge's "Read Aloud" feature: full sentences with actual intonation, dozens of voice choices (en-US-GuyNeural, en-US-AriaNeural, en-US-ChristopherNeural, and equivalents in other languages), still completely free. Worth knowing: it does this by talking to the same backend the Edge browser itself uses internally — it's not an officially published API for third-party use, so treat it as a great free tool, not a guaranteed-forever one. If it ever breaks, Azure's official Cognitive Services Speech API uses the same voice models as a paid, supported fallback.