{"record":{"id":"6a51b1c05884d342","repo":"SubtitleEdit/subtitleedit","slug":"paddleocr-not-found-on-path-install-it-e-g-pip","errorCode":null,"errorMessage":"PaddleOCR not found on PATH. Install it (e.g. `pip install paddleocr`) and ensure the `paddleocr` binary is on PATH.","messagePattern":"PaddleOCR not found on PATH\\. Install it \\(e\\.g\\. `pip install paddleocr`\\) and ensure the `paddleocr` binary is on PATH\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/seconv/Core/PaddleOcrEngine.cs","lineNumber":47,"sourceCode":"    {\n        var name = OperatingSystem.IsWindows() ? \"paddleocr.exe\" : \"paddleocr\";\n        var pathEnv = Environment.GetEnvironmentVariable(\"PATH\") ?? string.Empty;\n        var separator = OperatingSystem.IsWindows() ? ';' : ':';\n        foreach (var dir in pathEnv.Split(separator, StringSplitOptions.RemoveEmptyEntries))\n        {\n            var candidate = Path.Combine(dir.Trim(), name);\n            if (File.Exists(candidate))\n            {\n                return candidate;\n            }\n        }\n        return null;\n    }\n\n    public static PaddleOcrEngine Create(string language = \"en\")\n    {\n        var path = Detect()\n            ?? throw new InvalidOperationException(\n                \"PaddleOCR not found on PATH. Install it (e.g. `pip install paddleocr`) \" +\n                \"and ensure the `paddleocr` binary is on PATH.\");\n\n        var workDir = Path.Combine(Path.GetTempPath(), \"seconv_paddle_\" + Guid.NewGuid().ToString(\"N\"));\n        Directory.CreateDirectory(workDir);\n        return new PaddleOcrEngine(path, language, workDir);\n    }\n\n    public string Recognize(SKBitmap bitmap)\n    {\n        if (bitmap is null || bitmap.Width == 0 || bitmap.Height == 0)\n        {\n            return string.Empty;\n        }\n\n        var pngPath = Path.Combine(_workDir, \"in_\" + Guid.NewGuid().ToString(\"N\") + \".png\");\n        try\n        {","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/SubtitleEdit/subtitleedit/blob/17a9f0748781032255db3526b7215d2fb891e3af/src/seconv/Core/PaddleOcrEngine.cs#L29-L65","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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)."],"exampleFix":"# before\nseconv in.sup out.srt --ocr-engine paddle   # binary missing\n# after\npip install paddleocr\nseconv in.sup out.srt --ocr-engine paddle","handlingStrategy":"validation","validationCode":"if (options.OcrEngine is \"paddle\" or \"paddleocr\" && PaddleOcrEngine.Detect() is null)\n    throw new InvalidOperationException(\"paddleocr not on PATH; pip install paddleocr\");","typeGuard":"static bool IsPaddleInstalled() => PaddleOcrEngine.Detect() is not null;","tryCatchPattern":"try { var engine = PaddleOcrEngine.Create(lang); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"not found on PATH\"))\n{\n    // print install instructions, fall back to tesseract\n}","preventionTips":["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."],"tags":["ocr","paddleocr","path","environment","external-dependency","python"],"backgroundTag":null,"analyzedSha":"17a9f0748781032255db3526b7215d2fb891e3af","analyzedAt":"2026-08-13T18:11:43.374Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}