-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
FIX: qt5 macOS 11 compatibility #8554
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should check whether we're actually running on Big Sur, and if we are, we don't even need to check whether the environment variable exists -- we'll need to set it correctly anyway in order to make things work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or even simpler, just set the variable if running on
darwin– I just checked on macOS Mojave and my PyQt5 app still works after setting it.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for testing @cbrnr!
@hoechenberger I am reluctant to silently overwrite an environment variable that the user already set, unless you are sure that the user would never want it to be a different value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's highly unlikely that a user set this variable for something other than fixing the PyQt5 bug. In this case, the value must be 1, so if you do not want to overwrite an existing variable the problem isn't fixed. I would set the variable to 1 when running on macOS, and if that variable has already been set to a value other than 1 I'd issue a warning. After all, this is a workaround, which hopefully we won't have to use for long.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But with the current implementation you're also changing the environment permanently (setting a new variable if it doesn't already exist, changing behavior)
In the Study Template we had to deal with a similar issue and solved it this way:
https://github.com/mne-tools/mne-study-template/blob/766cc0e2dcab1fecf61804e1b013ba37988f212c/run.py#L135-L148
Wonder if this is something we could re-use here too..?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So we would have to combine the platform conditional with
modified_env, isn't that a bit overkill? I just wanted to avoid messing with a power user's setting, but did not think setting this variable would interfere with the average use case.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I didn't mean to make this more complicated than it needs to be.
I'd also be fine with simply setting the env variable no matter what, and setting ourselves a reminder to revert this change as soon as new (fixed) MPL binaries have been released.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hoechenberger FWIW I'm not sure why you have any
atexit, no env vars are saved/written when doingpython:There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wait... what?! Wow. I thought those were changed permanently. Good to know!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hoechenberger if you do e.g.
signal.signal(signal.SIGINT, lambda: pass)(like it's implemented right now except instead oflambda: passyou have_restore_env(a function with no parameters), you will (1) get an error because you need to pass a function with two parameters, and (2) even if you pass a function with the correct signature (e.g.signal.signal(signal.SIGINT, lambda x, y: pass)) you need to make sure that the previous behavior ofSIGINTis retained (i.e. aKeyboardInterruptExceptionshould be thrown at the end to halt the program), otherwise the program will continue to run even if the user presses Ctrl + C.