tonhowtf/omniget · error

tesseract nao esta instalado

Error message

tesseract nao esta instalado

What it means

OCR operations require the tesseract binary; super::ocr::locate() asynchronously searches for it and returns None when absent. The OCR entry point then throws "tesseract nao esta instalado" ("tesseract is not installed").

Solutions

  1. Install tesseract (apt install tesseract-ocr / brew install tesseract).
  2. On Windows, install UB-Mannheim tesseract and add its directory to PATH.
  3. Install required language packs (e.g. tesseract-ocr-por) for non-English langs.
  4. Pre-check locate() in the UI and prompt the user to install tesseract before offering OCR.

Example fix

// before
ocr(&OcrOptions { langs: "por".into(), .. })

// after
if super::ocr::locate().await.is_none() {
    eprintln!("install tesseract-ocr to use OCR");
} else {
    ocr(&OcrOptions { langs: "por".into(), .. });
}
Defensive patterns

Strategy: validation

Validate before calling

async fn tesseract_ready() -> bool {
    super::ocr::locate().await.is_some()
}
// #[tokio::main] context:
// if !tesseract_ready().await { show_install_hint(); return; }

Try / catch

match run_ocr(&opts).await {
    Ok(out) => use(out),
    Err(e) if e.to_string().contains("tesseract nao esta instalado") => {
        eprintln!("Install tesseract-ocr (and language packs) to enable OCR");
    }
    Err(e) => eprintln!("ocr failed: {e}"),
}

Prevention

When it happens

Trigger: Calling the OCR function (input, langs, output_dir, dpi, progress signature) on a system where tesseract is not installed or not discoverable via PATH/standard install locations.

Common situations: macOS/Linux machines without tesseract installed; Windows without the UB-Mannheim build or not on PATH; CI containers lacking OCR tooling; users selecting OCR without realizing an external binary is required.

Understand the failure class

Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.

Related errors


AI-assisted analysis of tonhowtf/omniget@8600b91f42 (2026-09-12). Data as JSON: /api/errors/62e84b8b0e673ffa. Report an issue: GitHub.

Appendix: source

Thrown at src-tauri/omniget-core/src/core/tools/pdf.rs:1227

    let output =
        unique(out_dir_for(&input, output_dir).join(format!("{} (seguro).pdf", stem(&input))));
    let dpi = if dpi == 0 { 150 } else { dpi };
    let quality = if quality == 0 { 85 } else { quality };
    rasterize(&input, &output, dpi, quality, progress)
}

// ── OCR (PDF pesquisável) ──────────────────────────────────────────────

pub async fn ocr(
    input: String,
    langs: String,
    output_dir: String,
    dpi: u32,
    progress: super::ProgressFn,
) -> anyhow::Result<PdfOut> {
    let tesseract = super::ocr::locate()
        .await
        .ok_or_else(|| anyhow!("tesseract nao esta instalado"))?;
    let input_path = PathBuf::from(input.trim());
    let langs = if langs.trim().is_empty() {
        "eng".to_string()
    } else {
        langs.trim().to_string()
    };
    let dpi = if dpi == 0 { 300 } else { dpi };
    let work = super::temp_dir().join(format!("pdf-ocr-{}", uuid::Uuid::new_v4()));
    std::fs::create_dir_all(&work)?;

    // 1) páginas → PNG
    let (pngs, pages) = {
        let work = work.clone();
        let input = input_path.clone();
        let progress = progress.clone();
        tokio::task::spawn_blocking(move || -> anyhow::Result<(Vec<PathBuf>, usize)> {
            let api = api()?;
            let _g = OPS.lock().unwrap_or_else(|p| p.into_inner());

View on GitHub (pinned to 8600b91f42)