docling-project/docling · error · ImportError

Nemotron OCR is not installed. Install the optional dependen

Error message

Nemotron OCR is not installed. Install the optional dependency via `pip install "docling[feat-ocr-nemotron]"` on Linux x86_64 with Python 3.12 and CUDA 13.x.

What it means

The Nemotron OCR stage imports nemotron_ocr in __init__ when enabled; ImportError is raised when the optional package is absent, instructing you to install the `docling[feat-ocr-nemotron]` extra. The extra is constrained to Linux x86_64, Python 3.12, and CUDA 13.x because the upstream wheels only publish for that matrix.

Source

Thrown at docling/models/stages/ocr/nemotron_ocr_model.py:135

            enabled=enabled,
            artifacts_path=artifacts_path,
            options=options,
            accelerator_options=accelerator_options,
        )
        self.options: NemotronOcrOptions
        # multiplier for 72 dpi; the default 3.0 == 216 dpi.
        self.scale = self.options.scale

        if self.enabled:
            self.validate_runtime(accelerator_options=accelerator_options)
            self._nemotron_checkpoint_files = []
            try:
                from nemotron_ocr.inference.pipeline import CHECKPOINT_FILES
                from nemotron_ocr.inference.pipeline_v2 import NemotronOCRV2

                self._nemotron_checkpoint_files = CHECKPOINT_FILES
            except ImportError as exc:
                raise ImportError(
                    "Nemotron OCR is not installed. Install the optional dependency "
                    'via `pip install "docling[feat-ocr-nemotron]"` on Linux x86_64 with '
                    "Python 3.12 and CUDA 13.x."
                ) from exc

            # Resolve the request language
            language = resolve_nemotronocr_language(options.lang)

            # Initialize the model
            model_dir = self._resolve_model_dir(language, artifacts_path=artifacts_path)

            self.reader = NemotronOCRV2(
                model_dir=None if model_dir is None else str(model_dir),
                lang=language,
            )

    @staticmethod
    def _fail_runtime(message: str) -> None:

View on GitHub (pinned to 61d76f1ff3)

Solutions

  1. On Linux x86_64 with Python 3.12 and CUDA 13.x, run `pip install "docling[feat-ocr-nemotron]"`.
  2. If your platform/Python does not match, use a matching container/interpreter (e.g. python:3.12 Linux image with CUDA) or pick another OCR engine (Tesseract, EasyOCR, RapidOCR).
  3. Confirm the import works: `python -c "from nemotron_ocr.inference.pipeline_v2 import NemotronOCRV2"`.

Example fix

# before
options = NemotronOcrOptions()  # enabled without package -> ImportError

# after (terminal, Linux x86_64 / Python 3.12 / CUDA 13.x)
pip install "docling[feat-ocr-nemotron]"
Defensive patterns

Strategy: validation

Validate before calling

def nemotron_available() -> bool:
    try:
        from nemotron_ocr.inference.pipeline_v2 import NemotronOCRV2  # noqa: F401
        return True
    except ImportError:
        return False

Prevention

When it happens

Trigger: Enabling NemotronOcrOptions in an environment without the nemotron_ocr package — e.g. plain `pip install docling` on any platform, or even on Linux/Python 3.12 without the extra.

Common situations: Trying the newest OCR engine after a docling upgrade without adding the feature extra; attempting to use it on macOS/Windows or Python 3.10/3.11/3.13 where the dependency cannot install.

Related errors


AI-assisted analysis of docling-project/docling@61d76f1ff3 (2026-08-14). Data as JSON: /api/errors/6bc56f688da46d39. Report an issue: GitHub.