SubtitleEdit/subtitleedit · error · InvalidOperationException
PaddleOCR not found on PATH. Install it (e.g. `pip install p
Error message
PaddleOCR not found on PATH. Install it (e.g. `pip install paddleocr`) and ensure the `paddleocr` binary is on PATH.
What it means
Thrown by PaddleOcrEngine.Create when Detect() returns null, i.e. neither `paddleocr` nor `paddleocr.exe` is found in any directory listed in the PATH environment variable. Unlike tesseract (data files) or nocr (db), PaddleOCR is an external Python CLI that seconv shells out to, so its binary must be independently installed and discoverable.
Source
Thrown at src/seconv/Core/PaddleOcrEngine.cs:47
{
var name = OperatingSystem.IsWindows() ? "paddleocr.exe" : "paddleocr";
var pathEnv = Environment.GetEnvironmentVariable("PATH") ?? string.Empty;
var separator = OperatingSystem.IsWindows() ? ';' : ':';
foreach (var dir in pathEnv.Split(separator, StringSplitOptions.RemoveEmptyEntries))
{
var candidate = Path.Combine(dir.Trim(), name);
if (File.Exists(candidate))
{
return candidate;
}
}
return null;
}
public static PaddleOcrEngine Create(string language = "en")
{
var path = Detect()
?? throw new InvalidOperationException(
"PaddleOCR not found on PATH. Install it (e.g. `pip install paddleocr`) " +
"and ensure the `paddleocr` binary is on PATH.");
var workDir = Path.Combine(Path.GetTempPath(), "seconv_paddle_" + Guid.NewGuid().ToString("N"));
Directory.CreateDirectory(workDir);
return new PaddleOcrEngine(path, language, workDir);
}
public string Recognize(SKBitmap bitmap)
{
if (bitmap is null || bitmap.Width == 0 || bitmap.Height == 0)
{
return string.Empty;
}
var pngPath = Path.Combine(_workDir, "in_" + Guid.NewGuid().ToString("N") + ".png");
try
{View on GitHub (pinned to 17a9f07487)
Solutions
- Install PaddleOCR: `pip install paddleocr`.
- Activate the venv/conda env where paddleocr is installed before running seconv.
- Add the paddleocr binary's directory to PATH (e.g. `export PATH="$PATH:$(python -m site --user-base)/bin").
- On Windows add `%PYTHON%\Scripts` to PATH.
- Verify with `which paddleocr` (Unix) or `where paddleocr.exe` (Windows).
Example fix
# before seconv in.sup out.srt --ocr-engine paddle # binary missing # after pip install paddleocr seconv in.sup out.srt --ocr-engine paddle
Defensive patterns
Strategy: validation
Validate before calling
if (options.OcrEngine is "paddle" or "paddleocr" && PaddleOcrEngine.Detect() is null)
throw new InvalidOperationException("paddleocr not on PATH; pip install paddleocr"); Type guard
static bool IsPaddleInstalled() => PaddleOcrEngine.Detect() is not null;
Try / catch
try { var engine = PaddleOcrEngine.Create(lang); }
catch (InvalidOperationException ex) when (ex.Message.Contains("not found on PATH"))
{
// print install instructions, fall back to tesseract
} Prevention
- Run PaddleOcrEngine.Detect() during startup health checks.
- Pin paddleocr in a requirements.txt and install in your image build.
- Activate the venv that owns paddleocr before launching seconv.
When it happens
Trigger: Calling `OcrEngineFactory.Create` with `--ocr-engine paddle` (or paddleocr) on a host where the paddleocr executable is not on PATH. Detect() splits PATH and checks File.Exists for the binary name in each dir.
Common situations: PaddleOCR installed in a virtualenv that is not activated; installed via pip but the Scripts/bin dir is not on PATH; running in a container without paddleocr preinstalled; Windows where the .exe lives in `%PYTHON%\Scripts\` which is not on PATH.
Related errors
- paddleocr exited with code {proc.ExitCode}: {err}
- Tesseract not found on PATH. Install it from https://tessera
- llama-server not found. Either: download llama.cpp in Subtit
- OCR model file not found: {name}
- Failed to start paddleocr process.
AI-assisted analysis of SubtitleEdit/subtitleedit@17a9f07487 (2026-08-13).
Data as JSON: /api/errors/6a51b1c05884d342.
Report an issue: GitHub.