How To Install python-html5-parser on Ubuntu 18.04

In this tutorial we learn how to install python-html5-parser on Ubuntu 18.04. python-html5-parser is fast, standards compliant, C based, HTML 5 parser for python

Introduction

In this tutorial we learn how to install python-html5-parser on Ubuntu 18.04.

What is python-html5-parser

python-html5-parser is:

A fast implementation of the HTML 5 parsing spec for Python. Parsing is done in C using a variant of the gumbo parser. The gumbo parse tree is then transformed into an lxml tree, also in C, yielding parse times that can be a thirtieth of the html5lib parse times. That is a speedup of 30x. This differs, for instance, from the gumbo python bindings, where the initial parsing is done in C but the transformation into the final tree is done in python.

There are three methods to install python-html5-parser on Ubuntu 18.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install python-html5-parser Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install python-html5-parser using apt-get by running the following command:

sudo apt-get -y install python-html5-parser

Install python-html5-parser Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install python-html5-parser using apt by running the following command:

sudo apt -y install python-html5-parser

Install python-html5-parser Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install python-html5-parser using aptitude by running the following command:

sudo aptitude -y install python-html5-parser

How To Uninstall python-html5-parser on Ubuntu 18.04

To uninstall only the python-html5-parser package we can use the following command:

sudo apt-get remove python-html5-parser

Uninstall python-html5-parser And Its Dependencies

To uninstall python-html5-parser and its dependencies that are no longer needed by Ubuntu 18.04, we can use the command below:

sudo apt-get -y autoremove python-html5-parser

Remove python-html5-parser Configurations and Data

To remove python-html5-parser configuration and data from Ubuntu 18.04 we can use the following command:

sudo apt-get -y purge python-html5-parser

Remove python-html5-parser configuration, data, and all of its dependencies

We can use the following command to remove python-html5-parser configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge python-html5-parser

References

Summary

In this tutorial we learn how to install python-html5-parser package on Ubuntu 18.04 using different package management tools: apt, apt-get and aptitude.