flake8 command not found

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

Introduction

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

flake8: command not found

or when using sudo you get the following error message

sudo: flake8: command not found

Solutions to flake8: command not found

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

In Ubuntu flake8 is provided by flake8 package.

flake8 is:

Flake8 is a wrapper around PyFlakes, pycodestyle, and Ned’s McCabe script. Flake8 runs all tools by launching the single ‘flake8’ script, but ignores pycodestyle and PyFlakes extended options and just uses defaults. It displays the warnings in a per-file, merged output.

This package provides flake8 binary.

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

sudo apt-get -y install flake8

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

You can also use apt command to install flake8.

sudo apt -y install flake8

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

sudo aptitude install flake8

Summary

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