> ## Content Index
> Fetch the complete content index at: https://datascientyst.com/llms.txt
> Use this file to discover other available public pages before exploring further.

# Importerror missing optional dependency html5lib pandas example
- URL: https://datascientyst.com/importerror-missing-optional-dependency-html5lib-pandas-example/
- Published: 2024-01-20T21:33:10.000Z
- Updated: 2024-01-20T21:33:10.000Z
- Author: John D K
- Tags: Pandas Error

In this tutorial, we'll show how to solve a common **Pandas error – "importerror missing optional dependency html5lib pandas example"**.

We get this error from the Pandas when we try to use the method `read_html()` but the library `html5lib` is not installed.

## Fix Importerror missing optional dependency html5lib

This library can be installed by:

```python
pip install html5lib

```

## Dependency html5lib

The html5lib library is optional dependency for Pandas. The full list of optional dependencies for Pandas can be found here: [Pandas Optional dependencies](https://pandas.pydata.org/pandas-docs/stable/getting%5Fstarted/install.html?ref=datascientyst.com#optional-dependencies)

You can find more information for this library on link:

- [https://github.com/html5lib/html5lib-python](https://github.com/html5lib/html5lib-python?ref=datascientyst.com)
- [https://pypi.org/project/html5lib/](https://pypi.org/project/html5lib/?ref=datascientyst.com)

## read\_html dependencies

There are 3 dependencies recommended for Pandas when you need to read data with method `read_html`:

One of the following combinations of libraries is needed to use the top-level [read\_html()](../reference/api/pandas.read%5Fhtml.html#pandas.read%5Fhtml "pandas.read_html") function:

- [BeautifulSoup4](https://www.crummy.com/software/BeautifulSoup?ref=datascientyst.com) and [html5lib](https://github.com/html5lib/html5lib-python?ref=datascientyst.com)
- [BeautifulSoup4](https://www.crummy.com/software/BeautifulSoup?ref=datascientyst.com) and [lxml](https://lxml.de/?ref=datascientyst.com)
- [BeautifulSoup4](https://www.crummy.com/software/BeautifulSoup?ref=datascientyst.com) and [html5lib](https://github.com/html5lib/html5lib-python?ref=datascientyst.com) and [lxml](https://lxml.de/?ref=datascientyst.com)

They can be installed by:

```python
pip install "pandas[html]

```

More info: [Pandas HTML](https://pandas.pydata.org/pandas-docs/stable/getting%5Fstarted/install.html?ref=datascientyst.com#html)

## Older Pandas Version

For older Pandas and Python version the same error:

> importerror missing optional dependency html5lib pandas example

Can be shown even if the library is installed. The reason might be wrong path to the local file:

```python
import pandas as pd
df = pd.read_html("/test/test.htm")

```

Latest Pandas version gives error: `ValueError: No tables found` when the file is missing or there's no table