{"record":{"id":"996f0e64a1253823","repo":"docling-project/docling","slug":"nemotron-ocr-requires-cuda-13-x-but-the-current-p","errorCode":null,"errorMessage":"Nemotron OCR requires CUDA 13.x, but the current PyTorch runtime reports CUDA {cuda_version!r}.","messagePattern":"Nemotron OCR requires CUDA 13\\.x, but the current PyTorch runtime reports CUDA (.+?)\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"docling/models/stages/ocr/nemotron_ocr_model.py","lineNumber":155,"sourceCode":"                    'via `pip install \"docling[feat-ocr-nemotron]\"` on Linux x86_64 with '\n                    \"Python 3.12 and CUDA 13.x.\"\n                ) from exc\n\n            # Resolve the request language\n            language = resolve_nemotronocr_language(options.lang)\n\n            # Initialize the model\n            model_dir = self._resolve_model_dir(language, artifacts_path=artifacts_path)\n\n            self.reader = NemotronOCRV2(\n                model_dir=None if model_dir is None else str(model_dir),\n                lang=language,\n            )\n\n    @staticmethod\n    def _fail_runtime(message: str) -> None:\n        _log.error(message)\n        raise RuntimeError(message)\n\n    @classmethod\n    def validate_runtime(cls, accelerator_options: AcceleratorOptions) -> None:\n        if sys.platform != \"linux\":\n            cls._fail_runtime(\"Nemotron OCR is only supported on Linux.\")\n\n        if platform.machine() != \"x86_64\":\n            cls._fail_runtime(\"Nemotron OCR is only supported on x86_64 machines.\")\n\n        if sys.version_info[:2] != (3, 12):\n            cls._fail_runtime(\"Nemotron OCR requires Python 3.12.\")\n\n        requested_device = decide_device(accelerator_options.device)\n        if not requested_device.startswith(\"cuda\"):\n            cls._fail_runtime(\n                \"Nemotron OCR requires a CUDA accelerator. Set \"\n                \"`pipeline_options.accelerator_options.device` to CUDA or AUTO on a \"\n                \"CUDA-enabled machine.\"","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/docling-project/docling/blob/61d76f1ff3f8428065465889f7b4577da7df704c/docling/models/stages/ocr/nemotron_ocr_model.py#L137-L173","documentation":"The Nemotron checkpoints are built for CUDA 13.x; validate_runtime reads the PyTorch runtime's reported CUDA version (torch.version.cuda) and raises RuntimeError when it is not a 13.x string. This means your torch wheel was compiled against a different CUDA major version than Nemotron requires.","triggerScenarios":"torch installed with cu118/cu121/cu126 wheels while enabling Nemotron OCR; the reported torch.version.cuda is e.g. '12.4' or None (CPU build), failing the 13.x check.","commonSituations":"Reusing an existing environment with older CUDA torch; installing torch via a default index that pins a CUDA 12 wheel; mixing driver 13.x with torch cu12x.","solutions":["Reinstall PyTorch from the cu130 index: `pip install torch --index-url https://download.pytorch.org/whl/cu130` (or the current CUDA 13.x channel).","Verify `python -c \"import torch; print(torch.version.cuda)\"` reports a 13.x version and torch.cuda.is_available() is True.","Update the NVIDIA driver to one supporting CUDA 13.x if the runtime check fails after reinstalling torch."],"exampleFix":"# before\npip install torch  # or cu121 wheel -> torch.version.cuda == '12.1' -> RuntimeError\n\n# after\npip install torch --index-url https://download.pytorch.org/whl/cu130\npython -c \"import torch; print(torch.version.cuda)\"  # expect 13.x","handlingStrategy":"validation","validationCode":"import torch\n\ncuda = torch.version.cuda or \"\"\nassert cuda.startswith(\"13.\"), f\"Need CUDA 13.x torch, got {cuda!r}\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Install torch from the cu130 wheel index; assert torch.version.cuda startswith '13.' at startup.","Upgrade the NVIDIA driver to a CUDA 13.x-capable version alongside the torch reinstall.","Freeze the torch+CUDA combination in a lockfile to prevent accidental upgrades."],"tags":["nemotron","ocr","cuda","pytorch","version-mismatch"],"backgroundTag":null,"analyzedSha":"61d76f1ff3f8428065465889f7b4577da7df704c","analyzedAt":"2026-08-14T23:53:18.727Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}