{"record":{"id":"27b28335b25be8b9","repo":"run-llama/llama_index","slug":"you-must-install-the-lxml-package-to-use-this-no","errorCode":null,"errorMessage":"You must install the `lxml` package to use this node parser.","messagePattern":"You must install the `lxml` package to use this node parser\\.","errorType":"exception","errorClass":"ImportError","httpStatus":null,"severity":"error","filePath":"llama-index-core/llama_index/core/node_parser/relational/utils.py","lineNumber":45,"sourceCode":"    md_str = \"\\n\".join([line[2:-2] for line in lines])\n\n    # Check if the table is empty\n    if len(md_str) == 0:\n        return None\n\n    # Use pandas to read the CSV string into a DataFrame\n    try:\n        return pd.read_csv(StringIO(md_str))\n    except pd.errors.ParserError:\n        return None\n\n\ndef html_to_df(html_str: str) -> Any:\n    \"\"\"Convert HTML to dataframe.\"\"\"\n    try:\n        from lxml import html\n    except ImportError:\n        raise ImportError(\n            \"You must install the `lxml` package to use this node parser.\"\n        )\n\n    try:\n        import pandas as pd\n    except ImportError:\n        raise ImportError(\n            \"You must install the `pandas` package to use this node parser.\"\n        )\n\n    tree = html.fromstring(html_str)\n    table_element = tree.xpath(\"//table\")[0]\n    rows = table_element.xpath(\".//tr\")\n\n    data = []\n    for row in rows:\n        cols = row.xpath(\".//td\")\n        cols = [c.text.strip() if c.text is not None else \"\" for c in cols]","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/run-llama/llama_index/blob/afd0fef371831f9bda13e5af7167cf4e981278ab/llama-index-core/llama_index/core/node_parser/relational/utils.py#L27-L63","documentation":"Error \"You must install the `lxml` package to use this node parser.\" thrown in run-llama/llama_index.","triggerScenarios":"Thrown at llama-index-core/llama_index/core/node_parser/relational/utils.py:45 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Install lxml: `pip install lxml`."],"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"}