Epitran

raw JSON →
1.35.1 verified Fri May 01 auth: no python

Epitran is a library for transliterating text written in various writing systems into the International Phonetic Alphabet (IPA). Version 1.35.1 supports 50+ languages and scripts. Release cadence is irregular, with multiple releases in 2025-2026.

pip install epitran
error ValueError: Unsupported language: en
cause Using a plain language code without script (e.g., 'en' instead of 'eng-Latn').
fix
Use full language-script code, e.g., Epitran('eng-Latn'). List supported codes: epitran.list_languages().
error epitran.Epitran not found
cause Importing the class incorrectly as `epitran.Epitran` instead of `from epitran import Epitran`.
fix
Import using from epitran import Epitran.
error FileNotFoundError: [Errno 2] No such file or directory: '.../epitran/data/...'
cause Epitran data directory (~/.epitran) is missing or incomplete.
fix
Run epitran -d on the command line to download all required data. Ensure internet connectivity.
gotcha Epitran requires a language code in language-scrīpt format (e.g., 'spa-Latn' for Spanish). Using just 'en' will raise a ValueError.
fix Use the exact language-script code as specified in the documentation (e.g., 'eng-Latn', 'cmn-Hans').
gotcha Epitran uses a local data directory (~/.epitran) for lookup tables. If the data is missing, operations will fail silently or throw errors.
fix Run `epitran -d` after installation to download and set up the data, or let Epitran auto-download on first import (requires internet).
deprecated The old `epitran.Epitran()` instantiator may not work with Python < 3.10; as of v1.35.1, Python >=3.10 is required.
fix Upgrade Python to 3.10 or later. If stuck on older Python, use epitran < 1.35.0.
breaking In v1.34.0, the internal data format changed. Code relying on direct file access to ~/.epitran may break.
fix Use the public API (Epitran class) only; avoid reading data files directly.

Initialize Epitran with a language code (e.g., 'eng-Latn') and call .transliterate() to convert text to IPA.

from epitran import Epitran

# Create an Epitran object for English (eng-Latn)
epi = Epitran('eng-Latn')

# Transcribe a word to IPA
ipa = epi.transliterate('hello')
print(ipa)  # Output: həlˈoʊ