How To Install python3-chardet on Ubuntu 18.04

In this tutorial we learn how to install python3-chardet on Ubuntu 18.04. python3-chardet is universal character encoding detector for Python3

Introduction

In this tutorial we learn how to install python3-chardet on Ubuntu 18.04.

What is python3-chardet

python3-chardet is:

Chardet takes a sequence of bytes in an unknown character encoding, and attempts to determine the encoding.

Supported encodings:

  • ASCII, UTF-8, UTF-16 (2 variants), UTF-32 (4 variants)
  • Big5, GB2312, EUC-TW, HZ-GB-2312, ISO-2022-CN (Traditional and Simplified Chinese)
  • EUC-JP, SHIFT_JIS, ISO-2022-JP (Japanese)
  • EUC-KR, ISO-2022-KR (Korean)
  • KOI8-R, MacCyrillic, IBM855, IBM866, ISO-8859-5, windows-1251 (Cyrillic)
  • ISO-8859-2, windows-1250 (Hungarian)
  • ISO-8859-5, windows-1251 (Bulgarian)
  • windows-1252 (English)
  • ISO-8859-7, windows-1253 (Greek)
  • ISO-8859-8, windows-1255 (Visual and Logical Hebrew)
  • TIS-620 (Thai)

This library is a port of the auto-detection code in Mozilla.

This package contains the Python 3 version of the library.

There are three methods to install python3-chardet 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 python3-chardet Using apt-get

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

sudo apt-get update

After updating apt database, We can install python3-chardet using apt-get by running the following command:

sudo apt-get -y install python3-chardet

Install python3-chardet Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install python3-chardet using apt by running the following command:

sudo apt -y install python3-chardet

Install python3-chardet 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 python3-chardet using aptitude by running the following command:

sudo aptitude -y install python3-chardet

How To Uninstall python3-chardet on Ubuntu 18.04

To uninstall only the python3-chardet package we can use the following command:

sudo apt-get remove python3-chardet

Uninstall python3-chardet And Its Dependencies

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

sudo apt-get -y autoremove python3-chardet

Remove python3-chardet Configurations and Data

To remove python3-chardet configuration and data from Ubuntu 18.04 we can use the following command:

sudo apt-get -y purge python3-chardet

Remove python3-chardet configuration, data, and all of its dependencies

We can use the following command to remove python3-chardet configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge python3-chardet

References

Summary

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