chardet command not found

In this troubleshooting guide we learn how to fix chardet command not found error message

Introduction

When you run more command in linux terminal / console, you get the following error message

chardet: command not found

or when using sudo you get the following error message

sudo: chardet: command not found

Solutions to chardet: command not found

How To Fix chardet: command not found in Ubuntu / Debian / Kali Linux / Raspbian

In Ubuntu chardet is provided by python3-chardet package.

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.

To fix this problem, we can install more using the command below.

sudo apt-get -y install python3-chardet

This command might take some time to finish depending on your machine internet connection.

You can also use apt command to install python3-chardet.

sudo apt -y install python3-chardet

Or if you have aptitude installed you can use the following command.

sudo aptitude install python3-chardet

Summary

In this tutorial we learn how to fix chardet command not found error in Ubuntu / Debian / Kali Linux or Raspbian distribution.