Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PyGame mode issues in macOS 10.12 Sierra, 10.13 High Sierra, 10.14 Mojave #2423

Open
carlosperate opened this issue Jun 27, 2023 · 5 comments

Comments

@carlosperate
Copy link
Member

carlosperate commented Jun 27, 2023

In macOS 10.12 Sierra, 10.13 High Sierra and 10.14 Mojave, Mu is able to correctly create the virtualenv with dependencies, but when trying to run a pygame zero script it throws the following error in the console/repl panel:

pygame 2.5.0 (SDL 2.28.0, Python 3.8.13)
Hello from the pygame community. https://www.pygame.org/contribute.html
/Users/carlos/Library/Application Support/mu/mu_venv-38-20230627-100218/lib/python3.8/site-packages/pgzero/runner.py:2: RuntimeWarning: use mixer: dlopen(/Users/carlos/Library/Application Support/mu/mu_venv-38-20230627-100218/lib/python3.8/site-packages/pygame/mixer.cpython-38-darwin.so, 2): Library not loaded: @loader_path/libmp3lame.0.dylib
  Referenced from: /Users/carlos/Library/Application Support/mu/mu_venv-38-20230627-100218/lib/python3.8/site-packages/pygame/.dylibs/libsndfile.1.0.34.dylib
  Reason: no suitable image found.  Did find:
	/Users/carlos/Library/Application Support/mu/mu_venv-38-20230627-100218/lib/python3.8/site-packages/pygame/.dylibs/libmp3lame.0.dylib: cannot load 'libmp3lame.0.dylib' (load command 0x80000034 is unknown)
	/Users/carlos/Library/Application Support/mu/mu_venv-38-20230627-100218/lib/python3.8/site-packages/pygame/.dylibs/libmp3lame.0.dylib: cannot load 'libmp3lame.0.dylib' (load command 0x80000034 is unknown)
(ImportError: dlopen(/Users/carlos/Library/Application Support/mu/mu_venv-38-20230627-100218/lib/python3.8/site-packages/pygame/mixer.cpython-38-darwin.so, 2): Library not loaded: @loader_path/libmp3lame.0.dylib
  Referenced from: /Users/carlos/Library/Application Support/mu/mu_venv-38-20230627-100218/lib/python3.8/site-packages/pygame/.dylibs/libsndfile.1.0.34.dylib
  Reason: no suitable image found.  Did find:
	/Users/carlos/Library/Application Support/mu/mu_venv-38-20230627-100218/lib/python3.8/site-packages/pygame/.dylibs/libmp3lame.0.dylib: cannot load 'libmp3lame.0.dylib' (load command 0x80000034 is unknown)
	/Users/carlos/Library/Application Support/mu/mu_venv-38-20230627-100218/lib/python3.8/site-packages/pygame/.dylibs/libmp3lame.0.dylib: cannot load 'libmp3lame.0.dylib' (load command 0x80000034 is unknown))
  pygame.mixer.pre_init(frequency=22050, size=-16, channels=2)
Traceback (most recent call last):
  File "/Users/carlos/Downloads/Mu Editor.app/Contents/Resources/Python/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/Users/carlos/Downloads/Mu Editor.app/Contents/Resources/Python/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/Users/carlos/Library/Application Support/mu/mu_venv-38-20230627-100218/lib/python3.8/site-packages/pgzero/__main__.py", line 1, in <module>
    from pgzero.runner import main
  File "/Users/carlos/Library/Application Support/mu/mu_venv-38-20230627-100218/lib/python3.8/site-packages/pgzero/runner.py", line 2, in <module>
    pygame.mixer.pre_init(frequency=22050, size=-16, channels=2)
  File "/Users/carlos/Library/Application Support/mu/mu_venv-38-20230627-100218/lib/python3.8/site-packages/pygame/__init__.py", line 70, in __getattr__
    raise NotImplementedError(missing_msg)
NotImplementedError: mixer module not available (ImportError: dlopen(/Users/carlos/Library/Application Support/mu/mu_venv-38-20230627-100218/lib/python3.8/site-packages/pygame/mixer.cpython-38-darwin.so, 2): Library not loaded: @loader_path/libmp3lame.0.dylib
  Referenced from: /Users/carlos/Library/Application Support/mu/mu_venv-38-20230627-100218/lib/python3.8/site-packages/pygame/.dylibs/libsndfile.1.0.34.dylib
  Reason: no suitable image found.  Did find:
	/Users/carlos/Library/Application Support/mu/mu_venv-38-20230627-100218/lib/python3.8/site-packages/pygame/.dylibs/libmp3lame.0.dylib: cannot load 'libmp3lame.0.dylib' (load command 0x80000034 is unknown)
	/Users/carlos/Library/Application Support/mu/mu_venv-38-20230627-100218/lib/python3.8/site-packages/pygame/.dylibs/libmp3lame.0.dylib: cannot load 'libmp3lame.0.dylib' (load command 0x80000034 is unknown))


---------- FINISHED ----------
exit code: 1 status: 0
@carlosperate
Copy link
Member Author

carlosperate commented Jun 27, 2023

Going back to pygame version 2.1.2 works, and v2.1.3 and newer fails.

In macOS 10.14 Mojave:

$ /Users/carlos/Library/Application\ Support/mu/mu_venv-38-20230627-155005/bin/pip install "pygame==2.1.3"
Collecting pygame==2.1.3
  Downloading pygame-2.1.3-cp38-cp38-macosx_10_9_x86_64.whl (12.8 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 12.8/12.8 MB 5.6 MB/s eta 0:00:00
Installing collected packages: pygame
  Attempting uninstall: pygame
    Found existing installation: pygame 2.5.0
    Uninstalling pygame-2.5.0:
      Successfully uninstalled pygame-2.5.0
Successfully installed pygame-2.1.3

[notice] A new release of pip is available: 23.1 -> 23.1.2
[notice] To update, run: /Users/carlos/Library/Application Support/mu/mu_venv-38-20230627-155005/bin/python -m pip install --upgrade pip
$ 
$ 
$ /Users/carlos/Library/Application\ Support/mu/mu_venv-38-20230627-155005/bin/python -m pgzero
pygame 2.1.3 (SDL 2.0.22, Python 3.8.13)
Hello from the pygame community. https://www.pygame.org/contribute.html
/Users/carlos/Library/Application Support/mu/mu_venv-38-20230627-155005/lib/python3.8/site-packages/pgzero/runner.py:2: RuntimeWarning: use mixer: dlopen(/Users/carlos/Library/Application Support/mu/mu_venv-38-20230627-155005/lib/python3.8/site-packages/pygame/mixer.cpython-38-darwin.so, 2): Library not loaded: @loader_path/libomp.dylib
  Referenced from: /Users/carlos/Library/Application Support/mu/mu_venv-38-20230627-155005/lib/python3.8/site-packages/pygame/.dylibs/libfluidsynth.3.1.1.dylib
  Reason: no suitable image found.  Did find:
	/Users/carlos/Library/Application Support/mu/mu_venv-38-20230627-155005/lib/python3.8/site-packages/pygame/.dylibs/libomp.dylib: cannot load 'libomp.dylib' (load command 0x80000034 is unknown)
	/Users/carlos/Library/Application Support/mu/mu_venv-38-20230627-155005/lib/python3.8/site-packages/pygame/.dylibs/libomp.dylib: cannot load 'libomp.dylib' (load command 0x80000034 is unknown)
(ImportError: dlopen(/Users/carlos/Library/Application Support/mu/mu_venv-38-20230627-155005/lib/python3.8/site-packages/pygame/mixer.cpython-38-darwin.so, 2): Library not loaded: @loader_path/libomp.dylib
  Referenced from: /Users/carlos/Library/Application Support/mu/mu_venv-38-20230627-155005/lib/python3.8/site-packages/pygame/.dylibs/libfluidsynth.3.1.1.dylib
  Reason: no suitable image found.  Did find:
	/Users/carlos/Library/Application Support/mu/mu_venv-38-20230627-155005/lib/python3.8/site-packages/pygame/.dylibs/libomp.dylib: cannot load 'libomp.dylib' (load command 0x80000034 is unknown)
	/Users/carlos/Library/Application Support/mu/mu_venv-38-20230627-155005/lib/python3.8/site-packages/pygame/.dylibs/libomp.dylib: cannot load 'libomp.dylib' (load command 0x80000034 is unknown))
  pygame.mixer.pre_init(frequency=22050, size=-16, channels=2)
Traceback (most recent call last):
  File "/Users/carlos/Downloads/Mu Editor.app/Contents/Resources/Python/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/Users/carlos/Downloads/Mu Editor.app/Contents/Resources/Python/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/Users/carlos/Library/Application Support/mu/mu_venv-38-20230627-155005/lib/python3.8/site-packages/pgzero/__main__.py", line 1, in <module>
    from pgzero.runner import main
  File "/Users/carlos/Library/Application Support/mu/mu_venv-38-20230627-155005/lib/python3.8/site-packages/pgzero/runner.py", line 2, in <module>
    pygame.mixer.pre_init(frequency=22050, size=-16, channels=2)
  File "/Users/carlos/Library/Application Support/mu/mu_venv-38-20230627-155005/lib/python3.8/site-packages/pygame/__init__.py", line 70, in __getattr__
    raise NotImplementedError(missing_msg)
NotImplementedError: mixer module not available (ImportError: dlopen(/Users/carlos/Library/Application Support/mu/mu_venv-38-20230627-155005/lib/python3.8/site-packages/pygame/mixer.cpython-38-darwin.so, 2): Library not loaded: @loader_path/libomp.dylib
  Referenced from: /Users/carlos/Library/Application Support/mu/mu_venv-38-20230627-155005/lib/python3.8/site-packages/pygame/.dylibs/libfluidsynth.3.1.1.dylib
  Reason: no suitable image found.  Did find:
	/Users/carlos/Library/Application Support/mu/mu_venv-38-20230627-155005/lib/python3.8/site-packages/pygame/.dylibs/libomp.dylib: cannot load 'libomp.dylib' (load command 0x80000034 is unknown)
	/Users/carlos/Library/Application Support/mu/mu_venv-38-20230627-155005/lib/python3.8/site-packages/pygame/.dylibs/libomp.dylib: cannot load 'libomp.dylib' (load command 0x80000034 is unknown))
$ /Users/carlos/Library/Application\ Support/mu/mu_venv-38-20230627-155005/bin/pip install "pygame==2.1.2"
Collecting pygame==2.1.2
  Downloading pygame-2.1.2-cp38-cp38-macosx_10_9_x86_64.whl (8.9 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 8.9/8.9 MB 7.0 MB/s eta 0:00:00
Installing collected packages: pygame
  Attempting uninstall: pygame
    Found existing installation: pygame 2.1.3
    Uninstalling pygame-2.1.3:
      Successfully uninstalled pygame-2.1.3
Successfully installed pygame-2.1.2

[notice] A new release of pip is available: 23.1 -> 23.1.2
[notice] To update, run: /Users/carlos/Library/Application Support/mu/mu_venv-38-20230627-155005/bin/python -m pip install --upgrade pip
$ 
$ 
$ /Users/carlos/Library/Application\ Support/mu/mu_venv-38-20230627-155005/bin/python -m pgzero
pygame 2.1.2 (SDL 2.0.18, Python 3.8.13)
Hello from the pygame community. https://www.pygame.org/contribute.html
2023-06-27 16:40:35.800 python[489:5487] isPrefsCreateCacheFromEnabledAndDefaultInputSources - can't find anything from GetInputSourceEnabledPrefs, use defaultASCIIKeyLayoutDict = <CFBasicHash 0x7f9ff5e537a0 [0x7fffa26ab8e0]>{type = mutable dict, count = 3,
entries =>
	0 : <CFString 0x7fffa27167d8 [0x7fffa26ab8e0]>{contents = "InputSourceKind"} = <CFString 0x7fffa275bd18 [0x7fffa26ab8e0]>{contents = "Keyboard Layout"}
	1 : <CFString 0x7fffa2747e58 [0x7fffa26ab8e0]>{contents = "KeyboardLayout ID"} = <CFNumber 0xe9b9b2ba1f934ee3 [0x7fffa26ab8e0]>{value = +2, type = kCFNumberSInt64Type}
	9 : <CFString 0x7fffa27114d8 [0x7fffa26ab8e0]>{contents = "KeyboardLayout Name"} = British
}
Usage: __main__.py [options]

__main__.py: error: You must specify which module to run.

@carlosperate
Copy link
Member Author

carlosperate commented Jun 27, 2023

@carlosperate carlosperate changed the title PyGame mode issues in macOS 10.12 Sierra PyGame mode issues in macOS 10.12 Sierra, 10.13 High Sierra, 10.14 Mojave Jun 28, 2023
carlosperate added a commit that referenced this issue Jun 28, 2023
@illume
Copy link
Contributor

illume commented Jul 2, 2023

Hey hey.

Is this whilst using vmware?

Also I wonder what the mac model is?
(wondering if it is CPU instruction related)

@carlosperate
Copy link
Member Author

Hi René! Yes, this is using virtualised Intel macOS with VMware using an i7 Macbook Pro 2020.
Unfortunately I don't have any mac with macOS lower than 12 Monterey, so tests in older macOS versions are done with virtual machines.

carlosperate added a commit that referenced this issue Jul 3, 2023
carlosperate added a commit that referenced this issue Aug 7, 2023
@illume
Copy link
Contributor

illume commented Sep 9, 2023

Hey hey.

pygame==2.5.1 fixes this issue.

At least it does work on the 10.11, 10.12, and 10.13 tested on.

Hopefully it works for you too?

carlosperate added a commit that referenced this issue Dec 28, 2023
As discussed in #2423
pygame version 2.5.1 should have fixed the issue with older
macOS releases. So, we can remove this max version clamp.
carlosperate added a commit that referenced this issue Dec 28, 2023
As discussed in #2423
pygame version 2.5.1 should have fixed the issue with older
macOS releases. So, we can remove this max version clamp.
carlosperate added a commit that referenced this issue Jan 12, 2024
As discussed in #2423
pygame version 2.5.1 should have fixed the issue with older
macOS releases. So, we can remove this max version clamp.
carlosperate added a commit that referenced this issue Feb 5, 2024
As discussed in #2423
pygame version 2.5.1 should have fixed the issue with older
macOS releases. So, we can remove this max version clamp.
carlosperate added a commit that referenced this issue Feb 5, 2024
As discussed in #2423
pygame version 2.5.1 should have fixed the issue with older
macOS releases. So, we can remove this max version clamp.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants