{"record":{"id":"f5a3628ca8629972","repo":"docling-project/docling","slug":"whisper-is-not-installed-please-install-it-via-p","errorCode":null,"errorMessage":"whisper is not installed. Please install it via `pip install openai-whisper` or do `uv sync --extra asr`.","messagePattern":"whisper is not installed\\. Please install it via `pip install openai-whisper` or do `uv sync --extra asr`\\.","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"docling/pipeline/asr_transcriber.py","lineNumber":210,"sourceCode":"    def __init__(\n        self,\n        enabled: bool,\n        artifacts_path: Path | None,\n        accelerator_options: AcceleratorOptions,\n        asr_options: InlineAsrNativeWhisperOptions,\n    ):\n        \"\"\"Transcriber using native Whisper.\"\"\"\n        self.enabled = enabled\n\n        _log.info(f\"artifacts-path: {artifacts_path}\")\n        _log.info(f\"accelerator_options: {accelerator_options}\")\n\n        if self.enabled:\n            try:\n                import whisper  # type: ignore\n            except ImportError:\n                if sys.version_info < (3, 14):\n                    raise ImportError(\n                        \"whisper is not installed. Please install it via \"\n                        \"`pip install openai-whisper` or do `uv sync --extra asr`.\"\n                    )\n                else:\n                    raise ImportError(\n                        \"whisper is not installed. Unfortunately its dependencies \"\n                        \"are not yet available for Python 3.14.\"\n                    )\n\n            self.asr_options = asr_options\n            self.max_tokens = asr_options.max_new_tokens\n\n            self.device = decide_device(\n                accelerator_options.device,\n                supported_devices=asr_options.supported_devices,\n            )\n            _log.info(f\"Available device for Whisper: {self.device}\")\n","sourceCodeStart":192,"sourceCodeEnd":228,"githubUrl":"https://github.com/docling-project/docling/blob/61d76f1ff3f8428065465889f7b4577da7df704c/docling/pipeline/asr_transcriber.py#L192-L228","documentation":"The native-Whisper ASR transcriber (_WhisperModel) imports the optional `whisper` package (openai-whisper) when enabled; on Python < 3.14 the ImportError is re-raised with install instructions. It is a missing-optional-dependency error: docling's ASR support ships behind the `asr` extra rather than the base install.","triggerScenarios":"Enabling InlineAsrPipeline / AsrOptions with the default whisper engine in an environment where `import whisper` fails — i.e. docling installed without the asr extra. Raised from the transcriber constructor, so it fires at pipeline build time, not per-document.","commonSituations":"Running audio transcription (do_rotate=False + inline ASR on audio files) after `pip install docling` instead of `pip install 'docling[asr]'`; slim installs (docling-slim) that never bundle ASR deps.","solutions":["Install the ASR extra: uv sync --extra asr (or pip install 'docling[asr]')","Or install the engine directly: pip install openai-whisper","Or disable ASR / switch asr_options to an engine whose deps you have (e.g. mlx-whisper on Apple Silicon)"],"exampleFix":"# before\npip install docling\n\n# after\npip install 'docling[asr]'","handlingStrategy":"try-catch","validationCode":"def whisper_available() -> bool:\n    try:\n        import whisper  # noqa: F401\n        return True\n    except ImportError:\n        return False","typeGuard":null,"tryCatchPattern":"try:\n    pipeline = InlineAsrPipeline(...)\nexcept ImportError as e:\n    if 'openai-whisper' in str(e):\n        subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'openai-whisper'])\n        pipeline = InlineAsrPipeline(...)\n    else:\n        raise","preventionTips":["Declare 'docling[asr]' in your project dependencies when ASR is enabled","Feature-detect optional engines with importlib.util.find_spec before enabling the pipeline"],"tags":["asr","whisper","optional-dependency","installation"],"backgroundTag":null,"analyzedSha":"61d76f1ff3f8428065465889f7b4577da7df704c","analyzedAt":"2026-08-14T23:53:18.727Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}