{"record":{"id":"423292575ec6d984","repo":"docling-project/docling","slug":"vllm-is-not-installed-please-install-it-via-pip-423292","errorCode":null,"errorMessage":"vllm is not installed. Please install it via `pip install vllm`.","messagePattern":"vllm is not installed\\. Please install it via `pip install vllm`\\.","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"docling/models/vlm_pipeline_models/vllm_model.py","lineNumber":114,"sourceCode":"        self.vlm_options: InlineVlmOptions = vlm_options\n\n        self.llm = None\n        self.sampling_params = None\n        self.processor = None  # used for CHAT templating in formulate_prompt()\n        self.device = \"cpu\"\n        self.max_new_tokens = vlm_options.max_new_tokens\n        self.temperature = vlm_options.temperature\n\n        if not self.enabled:\n            return\n\n        from transformers import AutoProcessor\n\n        try:\n            from vllm import LLM, SamplingParams\n        except ImportError:\n            if sys.version_info < (3, 14):\n                raise ImportError(\n                    \"vllm is not installed. Please install it via `pip install vllm`.\"\n                )\n            else:\n                raise ImportError(\n                    \"vllm is not installed. It is not yet available on Python 3.14.\"\n                )\n\n        # Device selection\n        self.device = decide_device(\n            accelerator_options.device, supported_devices=vlm_options.supported_devices\n        )\n        _log.debug(f\"Available device for VLM: {self.device}\")\n\n        # Resolve artifacts path / cache folder\n        repo_cache_folder = vlm_options.repo_id.replace(\"/\", \"--\")\n        if artifacts_path is None:\n            artifacts_path = self.download_models(\n                self.vlm_options.repo_id, revision=self.vlm_options.revision","sourceCodeStart":96,"sourceCodeEnd":132,"githubUrl":"https://github.com/docling-project/docling/blob/61d76f1ff3f8428065465889f7b4577da7df704c/docling/models/vlm_pipeline_models/vllm_model.py#L96-L132","documentation":"VllmVlmModel imports vllm.LLM/SamplingParams at init; vllm is an optional, heavyweight dependency. On Python < 3.14 the ImportError is re-raised with the plain install instruction; on 3.14 a different message is used because no vllm wheel exists there yet.","triggerScenarios":"Selecting the vLLM engine on a Python < 3.14 interpreter where vllm is not installed; also when vllm is installed in a different virtualenv than the one running Docling.","commonSituations":"Assuming vllm ships with docling; fresh environments without the vllm extra; vllm wheel uninstallable due to CUDA/torch mismatches so the import fails.","solutions":["Install vllm in the same venv/interpreter Docling uses: pip install vllm (ensure CUDA setup matches)","If installation is impossible (CPU box), select the Transformers or MLX engine instead","After installing, verify with python -c 'from vllm import LLM' to catch wheel/torch mismatches early"],"exampleFix":"# before\nvlm_options.engine = \"vllm\"  # ImportError on python 3.12 without vllm\n# after\n# pip install vllm\nvlm_options.engine = \"vllm\"","handlingStrategy":"validation","validationCode":"import importlib.util\n\nif vlm_options.engine == 'vllm' and importlib.util.find_spec('vllm') is None:\n    raise ImportError('vLLM engine selected but vllm is not installed in this interpreter')","typeGuard":null,"tryCatchPattern":"try:\n    model = VllmVlmModel(...)\nexcept ImportError as e:\n    if 'pip install vllm' in str(e):\n        vlm_options.engine = 'transformers'  # degrade to local engine\n    else:\n        raise","preventionTips":["Install vllm in the exact venv Docling runs in; verify with python -c 'from vllm import LLM'","Match vllm wheel version to your CUDA/torch stack","Probe for vllm at startup when the engine is configurable"],"tags":["vllm","import-error","optional-dependency","gpu"],"backgroundTag":null,"analyzedSha":"61d76f1ff3f8428065465889f7b4577da7df704c","analyzedAt":"2026-08-14T23:53:18.727Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}