Use stdlib for setuptools on MinGW by radarhere · Pull Request #7131 · python-pillow/Pillow
MinGW is currently failing in main - https://github.com/python-pillow/Pillow/actions/runs/4861154081
https://www.msys2.org/docs/python/ states
setuptools >= 60.0 is currently incompatible with MSYS2. You can set export SETUPTOOLS_USE_DISTUTILS=stdlib to work around the issue. We are currently working on restoring compatibility.
Adding in SETUPTOOLS_USE_DISTUTILS="stdlib" fixes the problem.