What Python version do you work on? it is a very important parameter:
i haven't tried this but I know black works in versions above python 3.9, which i assume you use python 3.13 or 3.14 but for flake8 you need to install with the exact version you have even a small difference can render it unusable, if you installed flake8 here's what you should try:
python3.13 -m pip install flake8
instead of:
pip install flake8
Hope that helped!