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 not compatible with MacOS Mojave #555

Closed
adam-hotait opened this issue Oct 10, 2018 · 71 comments
Closed

Pygame not compatible with MacOS Mojave #555

adam-hotait opened this issue Oct 10, 2018 · 71 comments
Milestone

Comments

@adam-hotait
Copy link

adam-hotait commented Oct 10, 2018

Edit: pygame 2 works nicely with Mac now.

Use python3 -m pip install pygame


SDL discussion and bug report:

Homebrew issue is here: Homebrew/homebrew-core#33016


As discussed on this stackoverflow post, it seems that pygame is not compatible with MacOS Mojave, the latest version of MacOS.

Information on tests done can be found on the post. It might be a conflict with the graphical overlay managing its new Dark Mode.

@hevp
Copy link

hevp commented Oct 15, 2018

Same issue here, running

python -m pygame.examples.aliens

opens a window, sounds and music can be heard, but black screen surface all the time.

@illume
Copy link
Member

illume commented Oct 16, 2018

@illume illume added the 1.9.5 label Oct 16, 2018
@illume illume added this to the 1.9.5 milestone Oct 16, 2018
@illume illume mentioned this issue Oct 16, 2018
36 tasks
@ijean
Copy link

ijean commented Oct 21, 2018

Works without a problem, on a fresh Mojave install, with Python 3.7.0 from Miniconda, the version of PyGame reported is 1.9.4 .

screen shot 2018-10-21 at 7 06 20 am

@adam-hotait
Copy link
Author

Confirmed, it seems to work with miniconda

setminami added a commit to setminami/SunlightControl that referenced this issue Oct 30, 2018
@dshrops1
Copy link

Sorry if this is not the right place to post this, but is there a fix for this other than using miniconda? if not where can I follow to be aware when a fix is in place? I was really interested in picking up pygame but I might just go back to libGDX until this is working on Mojave!

@jctim
Copy link

jctim commented Nov 21, 2018

The bug is reproduced with python 3.7.1 + pygame 1.9.4
But isn't reproduced with python 3.6.5 + pygame 1.9.4

As a work-around I created a virtualenv for 3.6.5 version

@MrTrustworthy
Copy link

Can reproduce this using python 3.7.0, 3.6.6 and 3.6.5 with both virtualenv and venv, so downgrading python didn't seem to help.

All Python versions mentioned above were installed via pyenv, the pygame version was always 1.9.4. Interestingly, trying it with Python 3.5.6 failed during installation of pygame with src/scrap.c:27:10: fatal error: 'SDL.h' file not found, though I don't know if that's relevant.

@Levilutz
Copy link

I encounter this issue with python 3.6.5 + pygame 1.9.4 and python 3.7.1 + pygame 1.9.4
I do not encounter the issue with python 3.7.0 + pygame 1.9.4.
Framerate increases substantially whether it works or not but running app in low resolution.
I wonder why it would start working by switching up the 3.7.0, but then stop working again switching up to 3.7.1.

@reza-iranmanesh
Copy link

the miniconda suggestion didn't work for me; what i had to do was to download the pkg file from:

https://www.python.org/downloads/release/python-370/
for python 3.7.0
and install

verify:
python3 --version
should be 3.7.0

then:
pip3 install pygame (installed 1.9.4)

then all worked.

@ct-chook
Copy link

ct-chook commented Dec 20, 2018

Rolling back to python 3.7.0 and reinstalling pygame worked for me, but now the second problem is that display.update() became incredibly slow. The saucers in the aliens game in the examples move several times slower than before. I've timed display.update() and it seems that it takes a constant amount of time to redraw the screen regardless of how many rectangles you pass to it. Even passing a tiny 10x10 rectangle takes more than 200 ms to update.

Edit: The solution given below fixed this problem for me.
https://stackoverflow.com/questions/31685936/pygame-application-runs-slower-on-mac-than-on-pc

@nachoba
Copy link

nachoba commented Dec 30, 2018

As of Python 3.7.2 the issue is unresolved.

@WeMadeCode
Copy link

As of macOS Mojave 10.14.2 and Python 3.7.2 the issue is unresolved.

@lupinthird
Copy link

lupinthird commented Jan 8, 2019

I followed the advice up above and downloaded the official macOS x64 installer package of Python 3.7.2 from the official python page, and then used:

pip3 install pygame

And now I'm seeing the window contents again. (macOS 10.14.1, going to update to 10.14.2 and verify all else is fine).

@DanielJenkyn
Copy link

Looking at the Pygame 1.9.5 milestone...it states you are waiting for an SDL fix but it looks like this was fixed back SDL 2.0.8 (Current SDL 2.0.9) - https://bugzilla.libsdl.org/show_bug.cgi?id=4272

Im guessing that you are waiting for the 1.2.x historic version of SDL to be patched though?

@illume
Copy link
Member

illume commented Jan 11, 2019

@DanielJenkyn

If you download the official macOS x64 installer package of Python 3.7.2 from the official python page and then pip3 install pygame it works.

2 is using SDL2, 1.9.5 will use SDL1.

@DanielJenkyn
Copy link

DanielJenkyn commented Jan 12, 2019

@illume Just to point out, using python 3.7.2 and pip3 pygame works great...However the Homebrew version of python 3.7.2 results in the blank game window using the same version of pygame

@illume
Copy link
Member

illume commented Jan 14, 2019

Thanks @DanielJenkyn I updated the issue. I'm going to upgrade my mac in the coming days, so will be able to look into it then.

@idchlife
Copy link

As I understand, due to closed state of homebrew issue, they are not going to fix it, yes?

So the solution is to remove homebrew python3.7.2 and use official installer from python website?

@ChaseHardin
Copy link

ChaseHardin commented Jan 19, 2019

My operating system is macOS Mojave and I am experiencing the same thing. I've configured my development environment using Pyenv 1.2.9. On Pyenv, I've install Python 3.7.2 and Pygame 1.9.4. Python was installed using Pyenv and Pygame was installed using pip.

When running my code snippet, I get this screen:

screen shot 2019-01-18 at 8 16 10 pm

This error also occurs when running the Pygame example, python3 -m pygame.examples.aliens.

When can we expect Pygame to be compatible with Mojave?

NOTE: I've tried Python 3.7.2, 3.7.0, 3.6.5, and 3.6.1.

@idchlife
Copy link

@ChaseHardin I suspect installing 3.7.2 via official .dmg installer from python.org will do the trick. Did not try it myself, though, yet

@markph0204
Copy link
Contributor

@ChaseHardin Can you try pulling the latest from source/github? While I've been testing the 1.9.4 build has never worked on MacOS (other than Mojave) for me, BUT when I build -- even 1.9.4 from source, I have no issue.

This top section of the page -- are updates that I made -- and should work for you.
https://www.pygame.org/wiki/MacCompile

@ChaseHardin
Copy link

ChaseHardin commented Jan 23, 2019

@idchlife I'd like to continue using Pyenv so that I can have my own virtual environment. Any recommendations if I use Pyenv?

@markph0204 how would I pull the latest from source/github? I installed Pygame using the pip3 installer. Also to note, I'm using MacOS Mojave.

I'm seeing a lot of reference to mercurial. Is that something Python/Pygame needs to run?

@markph0204
Copy link
Contributor

markph0204 commented Jan 23, 2019

@ChaseHardin You do not need mercurial -- you need git and it comes installed on MacOS by default. To get the latest from pygame, you can git clone https://github.com/pygame/pygame.git then build it local or follow Step 5 on the page I shared: https://www.pygame.org/wiki/MacCompile

Also you can use pyenv -- just activate the environment you want before you pip install.

Good luck!

@marcinlesek
Copy link

Unfortunately, reproduced on MacOS Mojave 10.14.2, with pyenv pythons versions: 3.7.2, 3.7.0, 3.6.8 and 3.6.5 for pygame 1.9.4 installed from pipenv. 😕

I don't want to compiling sources, installing additional pythons which could a bit make mess on my Mac or so, it should be normally available with base python interpreter.

Hope to get it fixed and released soon, now need to change computer for my Linux. 🐧

@kronicle114
Copy link

@reza-iranmanesh 's instructions worked for me:

https://www.python.org/downloads/release/python-370/
for python 3.7.0
and install

verify:
python3 --version
should be 3.7.0

then:
pip3 install pygame (installed 1.9.4)

Downloading the macOS x64 installer package of Python 3.7.0 from the official python page and then pip3 install pygame. I'm using macOS Mojave 10.14.2. I just have to use the command python3 file_url to initiate.

@Adwait1997
Copy link

Adwait1997 commented Dec 3, 2019

pip install pygame=2.0.0.dev4

you mean 'pip install pygame ==2.00.dev4'
it will have == instead of =

@fnoquiq
Copy link

fnoquiq commented Dec 9, 2019

pip install pygame=2.0.0.dev4

you mean 'pip install pygame ==2.00.dev4'
it will have == instead of =

It worked for me on

MacOs Catalina 10.15.1

@29217321
Copy link

29217321 commented Dec 21, 2019

MacOS Catalina 10.15.2
Python 3.7.3 with below errors

pygame 2.0.0.dev4 (SDL 2.0.10, python 3.7.3)
Hello from the pygame community. https://www.pygame.org/contribute.html
Changing to FULLSCREEN
Traceback (most recent call last):
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"main", mod_spec)
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/Library/Python/3.7/site-packages/pygame/examples/aliens.py", line 350, in
main()
File "/Library/Python/3.7/site-packages/pygame/examples/aliens.py", line 285, in main
pygame.display.flip()
pygame.error: Window surface is invalid, please call SDL_GetWindowSurface() to get a new surface

@vegerot
Copy link

vegerot commented Dec 21, 2019

@29217321 Try the latest beta?

@diegolara078
Copy link

Finally get all sorted out... thank you all!
brew unlink python
Unlinking /usr/local/Cellar/python/3.6.5... 25 symlinks removed
sudo pip3 install pygame==2.0.0.dev4

@vikihu
Copy link

vikihu commented Dec 25, 2019

macOS Mojava10.14.6+python3.8.1+pygame==2.0.0.dev6 is ok.

@JonFillip
Copy link

JonFillip commented Jan 1, 2020

Works without a problem, on a fresh Mojave install, with Python 3.7.0 from Miniconda, the version of PyGame reported is 1.9.4 .

screen shot 2018-10-21 at 7 06 20 am

Hi there,

I'm trying to get the pygame window to open but I haven't had any luck. I'm running pygame 1.9.6 with python 3.8 and macOS Mojave.
and I guess we're both working on the alien pygame project.

@JonFillip
Copy link

macOS Mojava10.14.6+python3.8.1+pygame==2.0.0.dev6 is ok.

Dude you're my hero😂

@luckyguy73
Copy link

this worked for me
sudo pip3 install pygame==2.0.0.dev4

@justtomu
Copy link

This worked for me:
brew unlink python
sudo pip3 install pygame==2.0.0.dev4

Catalina 10.15.3

@vegerot
Copy link

vegerot commented Feb 23, 2020

Why unlink brew’s python? Please don’t use Apple’s

@iuliux
Copy link

iuliux commented Feb 29, 2020

Just installing 2.0.0.dev4 version of pygame and using (0, 0) for the window size did the trick for me.
No messing with the system-wide python version needed.

@mehularora8
Copy link

mehularora8 commented Apr 1, 2020

Installing pygame 2.0.0.dev6 fixed it for me.
pip3 install pygame==2.0.0.dev6
MacOS Catalina 10.15.2.

@tcwan
Copy link

tcwan commented Apr 2, 2020

I've created a local Portfile MacPorts-py-game2.zip for MacPorts for pygame 2.0.0.dev6, with the fix to the audio mixer problem for the aliens example. pygame 2.0.0.dev4 did not work due to "sorry, extended image module required" error. This would be easiest for those on macOS Mojave who are using MacPorts version of python.

You would need to know how to setup MacPorts to build local ports, etc.

This has been tested for Python 3.7, I didn't try to build it for the other python versions.

@Udit8348
Copy link

@mehularora8

Installing pygame 2.0.0.dev6 fixed it for me.
pip3 install pygame==2.0.0.dev6
MacOS Catalina 10.15.2.

Confirming that procedure also works for me on MacOS Catalina 10.15.4

@multitudes
Copy link

multitudes commented Apr 13, 2020

@mehularora8

Installing pygame 2.0.0.dev6 fixed it for me.
pip3 install pygame==2.0.0.dev6
MacOS Catalina 10.15.2.

Confirming that procedure also works for me on MacOS Catalina 10.15.4

Thanks! After a few hors of googling I made it work on Catalina 10.15.4 with the latest pygame 2.0.0.dev6

@dpandhi-git
Copy link

the miniconda suggestion didn't work for me; what i had to do was to download the pkg file from:

https://www.python.org/downloads/release/python-370/
for python 3.7.0
and install

verify:
python3 --version
should be 3.7.0

then:
pip3 install pygame (installed 1.9.4)

then all worked.

Thanks this work for me as well

@powelski
Copy link

powelski commented Sep 7, 2020

Python 3.8.5 (from Homebrew)
macOS Catalina 10.15.6
pip3 install pygame==2.0.0.dev10

Works like a charm 😅

I had issues with pygame 1.9.6 - empty gray screen. Also, cmd+q and cmd+w didn't work at all. Now they do 🥂🍾

@rishab-rb
Copy link

Python 3.8.5 (from Homebrew)
macOS Catalina 10.15.6
pip3 install pygame==2.0.0.dev10

Works like a charm 😅

I had issues with pygame 1.9.6 - empty gray screen. Also, cmd+q and cmd+w didn't work at all. Now they do 🥂🍾

same versions, but not working :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests