How to Install flake8 in Python
the modular source code checker: pep8 pyflakes and co
pip install flake8
What is flake8?
the modular source code checker: pep8 pyflakes and co
- PyFlakes - pycodestyle - Ned Batchelder's McCabe script
Flake8 runs all the tools by launching the single `` command. It displays the warnings in a per-file, merged output.
- files that contain this line are skipped::
Quick Start
Minimal example to get started with flake8:
import flake8
print(flake8.__version__)
Installation
pip (standard)
pip install flake8
Virtual environment (recommended)
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install flake8
pip3
pip3 install flake8
conda
conda install -c conda-forge flake8
Poetry
poetry add flake8
Dependencies
Installing flake8 will also install these packages:
Verify the Installation
After installing, confirm the package is available:
python -c "import flake8; print(flake8.__version__)"
If this prints a version number, installation succeeded. If you see a ModuleNotFoundError, see the errors section below.
Installation Errors
Common errors when installing flake8 with pip.
ModuleNotFoundError: No module named 'flake8'
Cause: The package is not installed in the current Python environment.
Fix: Run pip install flake8. If using a virtual environment, ensure it is activated first.
ModuleNotFoundError: No module named 'flake8' (installed but still failing)
Cause: pip installed the package into a different Python than the one running your script.
Fix: Use python -m pip install flake8 to install into the interpreter you are running.
ImportError: cannot import name 'X' from 'flake8'
Cause: The function or class does not exist in the installed version.
Fix: Check the version with pip show flake8 and upgrade with pip install --upgrade flake8.
pip: command not found
Cause: pip is not in PATH or Python was not added to PATH during installation.
Fix: Try python -m pip install flake8. On macOS/Linux try pip3.
PermissionError: [Errno 13] Permission denied
Cause: No write access to the system Python package directory.
Fix: Use a virtual environment, or add --user: pip install --user flake8
SSL: CERTIFICATE_VERIFY_FAILED
Cause: pip cannot verify PyPI's SSL certificate — common behind corporate proxies.
Fix: Try: pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org flake8
Recent Releases
| Version | Released |
|---|---|
7.3.0 latest |
2025-06-20 |
7.2.0 |
2025-03-29 |
7.1.2 |
2025-02-16 |
7.1.1 |
2024-08-04 |
7.1.0 |
2024-06-15 |
Manage flake8
Upgrade to latest version
pip install --upgrade flake8
Install a specific version
pip install flake8==7.3.0
Uninstall
pip uninstall flake8
Check what is installed
pip show flake8