I need Pygame 2 for my project. I have recently been on a Mac with an M1 processor, but I cannot install Pygame. I installed Python 3.9 with Homebrew, then SDL and others as recommended. During installation, version 2.01 of Pygame does not install nor version 2.0.0 but only version 1.9.6. But this version doesn't work with my project, if I run it it tells me that the pigame.mixer module was not found, moreover the project developer is using Pygame 2 methods.
Here is the result of the installation:
Collecting pygame
Using cached pygame-2.0.1.tar.gz (5.5 MB)
ERROR: Command errored out with exit status 1:
command: /opt/homebrew/opt/python@3.9/bin/python3.9 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/w8/n1kdqpdn6_q0893qnv348s580000gn/T/pip-install-6mir4cqu/pygame_142bfabb2faa435da22f87624750f4cd/setup.py'"'"'; __file__='"'"'/private/var/folders/w8/n1kdqpdn6_q0893qnv348s580000gn/T/pip-install-6mir4cqu/pygame_142bfabb2faa435da22f87624750f4cd/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/w8/n1kdqpdn6_q0893qnv348s580000gn/T/pip-pip-egg-info-u1qrzt0i
cwd: /private/var/folders/w8/n1kdqpdn6_q0893qnv348s580000gn/T/pip-install-6mir4cqu/pygame_142bfabb2faa435da22f87624750f4cd/
Complete output (27 lines):
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 1, in <module>
File "/private/var/folders/w8/n1kdqpdn6_q0893qnv348s580000gn/T/pip-install-6mir4cqu/pygame_142bfabb2faa435da22f87624750f4cd/setup.py", line 318, in <module>
buildconfig.config.main(AUTO_CONFIG)
File "/private/var/folders/w8/n1kdqpdn6_q0893qnv348s580000gn/T/pip-install-6mir4cqu/pygame_142bfabb2faa435da22f87624750f4cd/buildconfig/config.py", line 221, in main
deps = CFG.main(**kwds)
File "/private/var/folders/w8/n1kdqpdn6_q0893qnv348s580000gn/T/pip-install-6mir4cqu/pygame_142bfabb2faa435da22f87624750f4cd/buildconfig/config_darwin.py", line 131, in main
[DependencyProg('SDL', 'SDL_CONFIG', 'sdl2-config', '2.0', ['sdl'])],
File "/private/var/folders/w8/n1kdqpdn6_q0893qnv348s580000gn/T/pip-install-6mir4cqu/pygame_142bfabb2faa435da22f87624750f4cd/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
---
----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/c7/b8/06e02c7cca7aec915839927a9aa19f749ac17a3d2bb2610b945d2de0aa96/pygame-2.0.1.tar.gz#sha256=8b1e7b63f47aafcdd8849933b206778747ef1802bd3d526aca45ed77141e4001 (from https://pypi.org/simple/pygame/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Using cached pygame-2.0.0.tar.gz (5.5 MB)
ERROR: Command errored out with exit status 1:
command: /opt/homebrew/opt/python@3.9/bin/python3.9 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/w8/n1kdqpdn6_q0893qnv348s580000gn/T/pip-install-6mir4cqu/pygame_b8f2e42671424b84b18377944477dc5e/setup.py'"'"'; __file__='"'"'/private/var/folders/w8/n1kdqpdn6_q0893qnv348s580000gn/T/pip-install-6mir4cqu/pygame_b8f2e42671424b84b18377944477dc5e/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/w8/n1kdqpdn6_q0893qnv348s580000gn/T/pip-pip-egg-info-x9rp8x3u
cwd: /private/var/folders/w8/n1kdqpdn6_q0893qnv348s580000gn/T/pip-install-6mir4cqu/pygame_b8f2e42671424b84b18377944477dc5e/
Complete output (27 lines):
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 1, in <module>
File "/private/var/folders/w8/n1kdqpdn6_q0893qnv348s580000gn/T/pip-install-6mir4cqu/pygame_b8f2e42671424b84b18377944477dc5e/setup.py", line 318, in <module>
buildconfig.config.main(AUTO_CONFIG)
File "/private/var/folders/w8/n1kdqpdn6_q0893qnv348s580000gn/T/pip-install-6mir4cqu/pygame_b8f2e42671424b84b18377944477dc5e/buildconfig/config.py", line 221, in main
deps = CFG.main(**kwds)
File "/private/var/folders/w8/n1kdqpdn6_q0893qnv348s580000gn/T/pip-install-6mir4cqu/pygame_b8f2e42671424b84b18377944477dc5e/buildconfig/config_darwin.py", line 131, in main
[DependencyProg('SDL', 'SDL_CONFIG', 'sdl2-config', '2.0', ['sdl'])],
File "/private/var/folders/w8/n1kdqpdn6_q0893qnv348s580000gn/T/pip-install-6mir4cqu/pygame_b8f2e42671424b84b18377944477dc5e/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
---
----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/bc/0c/d164411381bada8feae57359aa9296defbed3035f4b55bef6a271cb0573c/pygame-2.0.0.tar.gz#sha256=63b038da116a643046181b02173fd894d87d2f85ecfd6aa7d5ece73c6ef501e9 (from https://pypi.org/simple/pygame/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Using cached pygame-1.9.6-cp39-cp39-macosx_11_0_arm64.whl
Installing collected packages: pygame
Successfully installed pygame-1.9.6
Thank you for your help !