black command not found

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

Introduction

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

black: command not found

or when using sudo you get the following error message

sudo: black: command not found

Solutions to black: command not found

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

In Ubuntu black is provided by black package.

black is:

Black is the uncompromising Python code formatter. By using it, you agree to cede control over minutiae of hand-formatting. In return, Black gives you speed, determinism, and freedom from pycodestyle nagging about formatting. You will save time and mental energy for more important matters.

Blackened code looks the same regardless of the project you’re reading. Formatting becomes transparent after a while and you can focus on the content instead.

Black makes code review faster by producing the smallest diffs possible.

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

sudo apt-get -y install black

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

You can also use apt command to install black.

sudo apt -y install black

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

sudo aptitude install black

Summary

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