The problem is that are you are using mingw Python.
Windows wheels (binaries) for Python packages are built with MSVC, because Python.org Python installs are built with MSVC. This ensures compatibility.
So since you have an unofficial version of Python it detects the incompatibility and sees that it has to build pygame from source.
The easiest way by far to get around this would be to use a standard Python installation instead. This doesn't mean you'd have to uninstall your existing Python, both could coexist. On Windows you can manage different versions of python with the py command. (py -0 lists, py -{version} executes that version).
There is some source support for MSYS2 stuff in the build configuration, but I have no idea how to use it. https://github.com/pygame-community/pygame-ce/commit/78b0574e493988878aafb37945f93c78ddc21a94 (I linked pygame-ce instead of pygame, since pygame-ce is the drop in fork of pygame I help maintain, and is more featureful)
Answer from Starbuck5 on Stack Overflowpython - Getting requirements to build wheel-error Pygame on Windows - Stack Overflow
Installation fails on VS Code + Python 3.13.9 interpreter + Windows 11 PC
(#solved) What am I doing wrong here?
Cannot install under Python 3.14
I was trying to install playsound, but i continuously ran into this error that said "Getting requirements to build wheel did not run successfully." I've tried restarting my computer and repairing my python, but neither of those worked. Anybody know how to fix this? (Keep in mind I'm still pretty new to python so I probably wont end up understanding unless you go into more detail than you think you need to.)
I'm completely new to python, and I watched a tutorial to install pygame, but I keep getting an error.
I have python downloaded and I'm in my command window, but when I run "pip install pygame", it spits out an error at "getting requirements to build wheel" that says "subprocess-exited-with-error". It's telling me that there's no setup file, and that the error originates from a subprocess and not pip. The error code is 1.
If anyone is able to help me figure this out I would be extremely grateful!
Edit: thank you all for your advice - I got it to work with pygame-ce!
I'm a high school student trying to get more into coding outside of school, but I've been having an issue trying to download Pygame for about 6 hours. I've searched online forums and videos and frankly I'm stuck. If you have a solution or any ideas please make sure to explain it to me like I'm five years old.
(I inputed "pip install pygame" as well as tryed multiple different variations I found online.)
File "C:\Users\dault\AppData\Local\Temp\pip-install-fdldlyzz\pygame_fcbd9d39db4940a3b190f77fcb8a6ab7\buildconfig\config_win.py", line 338, in configure
from buildconfig import vstools
File "C:\Users\dault\AppData\Local\Temp\pip-install-fdldlyzz\pygame_fcbd9d39db4940a3b190f77fcb8a6ab7\buildconfig\vstools.py", line 6, in <module>
from setuptools._distutils.msvccompiler import MSVCCompiler, get_build_architecture
ModuleNotFoundError: No module named 'setuptools._distutils.msvccompiler'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
Γ Getting requirements to build wheel did not run successfully.
β exit code: 1
β°β> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
Hello, I've been trying to install pygame, but I keep getting an error about getting requirements to build wheel. From what I've read online, it seems pip is trying to install a deprecated library while installing pygame, but I haven't found any solutions to the problem anywhere on old posts about the same issue.
Here's what is displayed when I do "py -m pip install pygame" :
Collecting pygame
Using cached pygame-2.6.1.tar.gz (14.8 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... error
error: subprocess-exited-with-error
Γ Getting requirements to build wheel did not run successfully.
β exit code: 1
β°β> [112 lines of output]
Skipping Cython compilation
WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
Using WINDOWS configuration...
Making dir :prebuilt_downloads:
Downloading... https://www.libsdl.org/release/SDL2-devel-2.28.4-VC.zip 25ef9d201ce3fd5f976c37dddedac36bd173975c
Unzipping :prebuilt_downloads\SDL2-devel-2.28.4-VC.zip:
Downloading... https://www.libsdl.org/projects/SDL_image/release/SDL2_image-devel-2.0.5-VC.zip 137f86474691f4e12e76e07d58d5920c8d844d5b
Unzipping :prebuilt_downloads\SDL2_image-devel-2.0.5-VC.zip:
Downloading... https://github.com/libsdl-org/SDL_ttf/releases/download/release-2.20.1/SDL2_ttf-devel-2.20.1-VC.zip 371606aceba450384428fd2852f73d2f6290b136
Unzipping :prebuilt_downloads\SDL2_ttf-devel-2.20.1-VC.zip:
Downloading... https://github.com/libsdl-org/SDL_mixer/releases/download/release-2.6.2/SDL2_mixer-devel-2.6.2-VC.zip 000e3ea8a50261d46dbd200fb450b93c59ed4482
Unzipping :prebuilt_downloads\SDL2_mixer-devel-2.6.2-VC.zip:
Downloading... https://github.com/pygame/pygame/releases/download/2.1.3.dev4/prebuilt-x64-pygame-2.1.4-20220319.zip 16b46596744ce9ef80e7e40fa72ddbafef1cf586
Unzipping :prebuilt_downloads\prebuilt-x64-pygame-2.1.4-20220319.zip:
copying into .\prebuilt-x64
Path for SDL: prebuilt-x64\SDL2-2.28.4
...Library directory for SDL: prebuilt-x64/SDL2-2.28.4/lib/x64
...Include directory for SDL: prebuilt-x64/SDL2-2.28.4/include
Path for FONT: prebuilt-x64\SDL2_ttf-2.20.1
...Library directory for FONT: prebuilt-x64/SDL2_ttf-2.20.1/lib/x64
...Include directory for FONT: prebuilt-x64/SDL2_ttf-2.20.1/include
Path for IMAGE: prebuilt-x64\SDL2_image-2.0.5
...Library directory for IMAGE: prebuilt-x64/SDL2_image-2.0.5/lib/x64
...Include directory for IMAGE: prebuilt-x64/SDL2_image-2.0.5/include
Path for MIXER: prebuilt-x64\SDL2_mixer-2.6.2
...Library directory for MIXER: prebuilt-x64/SDL2_mixer-2.6.2/lib/x64
...Include directory for MIXER: prebuilt-x64/SDL2_mixer-2.6.2/include
Path for PORTMIDI: prebuilt-x64
...Library directory for PORTMIDI: prebuilt-x64/lib
...Include directory for PORTMIDI: prebuilt-x64/include
DLL for SDL2: prebuilt-x64/SDL2-2.28.4/lib/x64/SDL2.dll
DLL for SDL2_ttf: prebuilt-x64/SDL2_ttf-2.20.1/lib/x64/SDL2_ttf.dll
DLL for SDL2_image: prebuilt-x64/SDL2_image-2.0.5/lib/x64/SDL2_image.dll
DLL for SDL2_mixer: prebuilt-x64/SDL2_mixer-2.6.2/lib/x64/SDL2_mixer.dll
DLL for portmidi: prebuilt-x64/lib/portmidi.dll
Path for FREETYPE: prebuilt-x64
...Library directory for FREETYPE: prebuilt-x64/lib
...Include directory for FREETYPE: prebuilt-x64/include
Path for PNG not found.
...Found include dir but no library dir in prebuilt-x64.
Path for JPEG not found.
...Found include dir but no library dir in prebuilt-x64.
DLL for freetype: prebuilt-x64/lib/freetype.dll
DLL for png: prebuilt-x64/SDL2_image-2.0.5/lib/x64/libpng16-16.dll
Traceback (most recent call last):
File "C:\Users\matro\AppData\Local\Temp\pip-install-1zhdeo_9\pygame_eb7a3368a9f3494ba92ebc290de71f20\buildconfig\vstools.py", line 4, in <module>
from distutils.msvccompiler import MSVCCompiler, get_build_architecture
ModuleNotFoundError: No module named 'distutils.msvccompiler'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\matro\AppData\Local\Temp\pip-install-1zhdeo_9\pygame_eb7a3368a9f3494ba92ebc290de71f20\buildconfig\config_win.py", line 336, in configure
from . import vstools
File "C:\Users\matro\AppData\Local\Temp\pip-install-1zhdeo_9\pygame_eb7a3368a9f3494ba92ebc290de71f20\buildconfig\vstools.py", line 6, in <module>
from setuptools._distutils.msvccompiler import MSVCCompiler, get_build_architecture
ModuleNotFoundError: No module named 'setuptools._distutils.msvccompiler'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\matro\AppData\Local\Temp\pip-install-1zhdeo_9\pygame_eb7a3368a9f3494ba92ebc290de71f20\buildconfig\vstools.py", line 4, in <module>
from distutils.msvccompiler import MSVCCompiler, get_build_architecture
ModuleNotFoundError: No module named 'distutils.msvccompiler'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\matro\AppData\Local\Programs\Python\Python314\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 389, in <module>
main()
~~~~^^
File "C:\Users\matro\AppData\Local\Programs\Python\Python314\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 373, in main
json_out["return_val"] = hook(**hook_input["kwargs"])
~~~~^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\matro\AppData\Local\Programs\Python\Python314\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 143, in get_requires_for_build_wheel
return hook(config_settings)
File "C:\Users\matro\AppData\Local\Temp\pip-build-env-kih6pz3u\overlay\Lib\site-packages\setuptools\build_meta.py", line 331, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=[])
~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\matro\AppData\Local\Temp\pip-build-env-kih6pz3u\overlay\Lib\site-packages\setuptools\build_meta.py", line 301, in _get_build_requires
self.run_setup()
~~~~~~~~~~~~~~^^
File "C:\Users\matro\AppData\Local\Temp\pip-build-env-kih6pz3u\overlay\Lib\site-packages\setuptools\build_meta.py", line 512, in run_setup
super().run_setup(setup_script=setup_script)
~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\matro\AppData\Local\Temp\pip-build-env-kih6pz3u\overlay\Lib\site-packages\setuptools\build_meta.py", line 317, in run_setup
exec(code, locals())
~~~~^^^^^^^^^^^^^^^^
File "<string>", line 432, in <module>
File "C:\Users\matro\AppData\Local\Temp\pip-install-1zhdeo_9\pygame_eb7a3368a9f3494ba92ebc290de71f20\buildconfig\config.py", line 234, in main
deps = CFG.main(**kwds, auto_config=auto)
File "C:\Users\matro\AppData\Local\Temp\pip-install-1zhdeo_9\pygame_eb7a3368a9f3494ba92ebc290de71f20\buildconfig\config_win.py", line 493, in main
return setup_prebuilt_sdl2(prebuilt_dir)
File "C:\Users\matro\AppData\Local\Temp\pip-install-1zhdeo_9\pygame_eb7a3368a9f3494ba92ebc290de71f20\buildconfig\config_win.py", line 453, in setup_prebuilt_sdl2
DEPS.configure()
~~~~~~~~~~~~~~^^
File "C:\Users\matro\AppData\Local\Temp\pip-install-1zhdeo_9\pygame_eb7a3368a9f3494ba92ebc290de71f20\buildconfig\config_win.py", line 338, in configure
from buildconfig import vstools
File "C:\Users\matro\AppData\Local\Temp\pip-install-1zhdeo_9\pygame_eb7a3368a9f3494ba92ebc290de71f20\buildconfig\vstools.py", line 6, in <module>
from setuptools._distutils.msvccompiler import MSVCCompiler, get_build_architecture
ModuleNotFoundError: No module named 'setuptools._distutils.msvccompiler'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed to build 'pygame' when getting requirements to build wheel
I'm trying to install pygame on my macbook pro but I keep running into errors. I've tried a few different things including pip install pygame --pre but that came up as command not found. I'm completely new to coding and don't really know what I'm doing so if someone could help me out that would be great. This is what comes up when I put in the code from pygame's site
Collecting pygame
Downloading pygame-2.1.2.tar.gz (10.1 MB)
ββββββββββββββββββββββββββββββββββββββββ 10.1/10.1 MB 5.7 MB/s eta 0:00:00
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
Γ python setup.py egg_info did not run successfully.
β exit code: 1
β°β> [31 lines of output]
WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
Using Darwin configuration...
/bin/sh: sdl2-config: command not found
/bin/sh: sdl2-config: command not found
/bin/sh: sdl2-config: command not found
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/private/var/folders/dc/svdtzmp910lf440sf2y2ckv80000gn/T/pip-install-eu2y9kle/pygame_e8033882705b411c88b6e8eca6af78ed/setup.py", line 359, in <module>
buildconfig.config.main(AUTO_CONFIG)
File "/private/var/folders/dc/svdtzmp910lf440sf2y2ckv80000gn/T/pip-install-eu2y9kle/pygame_e8033882705b411c88b6e8eca6af78ed/buildconfig/config.py", line 225, in main
deps = CFG.main(**kwds)
^^^^^^^^^^^^^^^^
File "/private/var/folders/dc/svdtzmp910lf440sf2y2ckv80000gn/T/pip-install-eu2y9kle/pygame_e8033882705b411c88b6e8eca6af78ed/buildconfig/config_darwin.py", line 132, in main
[DependencyProg('SDL', 'SDL_CONFIG', 'sdl2-config', '2.0', ['sdl'])],
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/private/var/folders/dc/svdtzmp910lf440sf2y2ckv80000gn/T/pip-install-eu2y9kle/pygame_e8033882705b411c88b6e8eca6af78ed/buildconfig/config_unix.py", line 39, in __init__
self.ver = config[0].strip()
~~~~~~^^^
IndexError: list index out of range
---
For help with compilation see:
https://www.pygame.org/wiki/MacCompile
To contribute to pygame development see:
https://www.pygame.org/contribute.html
---
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
Γ Encountered error while generating package metadata.
β°β> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.