{"record":{"id":"49b27ecb7a3cb5a8","repo":"run-llama/llama_index","slug":"spacy-is-not-installed-please-install-it-with-pi-49b27e","errorCode":null,"errorMessage":"Spacy is not installed, please install it with `pip install spacy`.","messagePattern":"Spacy is not installed, please install it with `pip install spacy`\\.","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"llama-index-core/llama_index/core/postprocessor/node.py","lineNumber":46,"sourceCode":"\n    required_keywords: List[str] = Field(default_factory=list)\n    exclude_keywords: List[str] = Field(default_factory=list)\n    lang: str = Field(default=\"en\")\n\n    @classmethod\n    def class_name(cls) -> str:\n        return \"KeywordNodePostprocessor\"\n\n    def _postprocess_nodes(\n        self,\n        nodes: List[NodeWithScore],\n        query_bundle: Optional[QueryBundle] = None,\n    ) -> List[NodeWithScore]:\n        \"\"\"Postprocess nodes.\"\"\"\n        try:\n            import spacy\n        except ImportError:\n            raise ImportError(\n                \"Spacy is not installed, please install it with `pip install spacy`.\"\n            )\n        from spacy.matcher import PhraseMatcher\n\n        nlp = spacy.blank(self.lang)\n        required_matcher = PhraseMatcher(nlp.vocab)\n        exclude_matcher = PhraseMatcher(nlp.vocab)\n        required_matcher.add(\"RequiredKeywords\", list(nlp.pipe(self.required_keywords)))\n        exclude_matcher.add(\"ExcludeKeywords\", list(nlp.pipe(self.exclude_keywords)))\n\n        new_nodes = []\n        for node_with_score in nodes:\n            node = node_with_score.node\n            doc = nlp(node.get_content())\n            if self.required_keywords and not required_matcher(doc):\n                continue\n            if self.exclude_keywords and exclude_matcher(doc):\n                continue","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/run-llama/llama_index/blob/afd0fef371831f9bda13e5af7167cf4e981278ab/llama-index-core/llama_index/core/postprocessor/node.py#L28-L64","documentation":"Error \"Spacy is not installed, please install it with `pip install spacy`.\" thrown in run-llama/llama_index.","triggerScenarios":"Thrown at llama-index-core/llama_index/core/postprocessor/node.py:46 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Install spacy: `pip install spacy`.","Download the needed spacy model, e.g. `python -m spacy download en_core_web_sm`."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"afd0fef371831f9bda13e5af7167cf4e981278ab","analyzedAt":"2026-08-15T05:42:58.429Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}