Recently I had a problem with my computer (permission issues) and had to get my computer reset, meaning I need to reinstall pygame. When I try to install pygame (using pip) I get the following error.
name]=@dhcp-133-143 ~ % pip install pygame
Collecting pygame
Using cached pygame-2.1.2.tar.gz (10.1 MB)
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/8k/tc80k7710czdxlkx3y3z1jhh0000gn/T/pip-install-yi5cifen/pygame_c0921b1ceb304676bfd314c918f4dbc2/setup.py", line 359, in <module>
buildconfig.config.main(AUTO_CONFIG)
File "/private/var/folders/8k/tc80k7710czdxlkx3y3z1jhh0000gn/T/pip-install-yi5cifen/pygame_c0921b1ceb304676bfd314c918f4dbc2/buildconfig/config.py", line 225, in main
deps = CFG.main(**kwds)
^^^^^^^^^^^^^^^^
File "/private/var/folders/8k/tc80k7710czdxlkx3y3z1jhh0000gn/T/pip-install-yi5cifen/pygame_c0921b1ceb304676bfd314c918f4dbc2/buildconfig/config_darwin.py", line 132, in main
[DependencyProg('SDL', 'SDL_CONFIG', 'sdl2-config', '2.0', ['sdl'])],
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/private/var/folders/8k/tc80k7710czdxlkx3y3z1jhh0000gn/T/pip-install-yi5cifen/pygame_c0921b1ceb304676bfd314c918f4dbc2/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.
How do I fix this error so I can install pygame on my computer. I have seen other people post about this error while using python 3.10 but none of the solutions seem to work for my computer. I would greatly appreciate any help or advice. Thanks. Also I am aware there have been other people asking similar questions however like I said none of the solutions worked for me. They all resulted in the same error.
I tried the following commands pip install pygame
, pip3 install pygame
,py -m pip install pygame
(and most variations using py and -m)
All of these commands result with the same metadata error. I am using the most recent version of python (I think).