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
[Bug]: Warning after update to macOS 14 "WARNING: Secure coding is not enabled for restorable state! Enable secure coding by implementing NSApplicationDelegate.applicationSupportsSecureRestorableState: and returning YES." #27389
Comments
We do not appear to explicitly use any of the serialize/deserialize functionality (and just rely on the default behavior) so I think all we have to do is add - (BOOL)applicationSupportsSecureRestorableState:(NSApplication *)app {
return YES;
} per https://sector7.computest.nl/post/2022-08-process-injection-breaking-all-macos-security-layers-with-a-single-vulnerability/ . I'm a bit confused where we are supposed to put that code? Do we just drop it in I am surprised that this happens on import of matplotlib. I would expect this to either be upstream Python issues (in which case our import should not matter) or if it is GUI backend dependent it should not be hit until after pyplot is imported. Is the backend resolution being hit much earlier than I expect? |
I am as yet unable to reproduce on my mac, so while we can add a the trivial I will note that I have an M1 mac, and it looks like you are using x86_64 here, though I'm not sure how much I'd expect that to be different in this regard. It is possible it is related to build-time environment variables (such as You are also on a (relatively) old version of python/matplotlib (though I did try on the combination you have, though not manged by edm). Do you see the same problem with e.g. python 3.11/3.12 and matplotlib 3.8? |
Unfortunately (or fortunately) I have not been able to reproduce the warning since restarting my
For what it's worth, when my machine was in the warning-generating state, I could also generate it with I've asked the poster at the Discourse site to chime in here if he can help with reproducing the warning. |
We got another report of this, which said they installed via pip, so perhaps worth looking into again... it's possible that eg I had some os settings set (though I tried not to change too much from default, since it's a secondary dev device for me) |
I've got the same warning. UPD: No such issue with Python 3.12.1. Operating system Matplotlib Version Python version
|
I just updated to 3.12, but it still exists on my end:
The warning still gets outputted. macOS: Sonoma 14.2.1 |
Can someone who is able to generate this warning please try adding the code from #27389 (comment) into |
I can reproduce this locally, and I don't think there is anything to do on Matplotlib's end, we don't override NSApplicationDelegate ourselves, our "App" is the Python Framework I believe. I think the solution is to update to the latest minor version of your Python release. Unfortunately, it looks like Python 3.12.1 doesn't contain the fix which is interesting because I thought the patch should have gone out with that.
|
I have almost the opposite observation:
Some other variables:
Action sequence: $ virtualenv .venv -p python3.10 ## or python3.11, or python3.12
$ python -m pip install matplotlib
$ python
>>> from matplotlib import pyplot
>>> a = pyplot.plot(1, 1) |
Interesting. I am guessing this has to do with clang versions then and possibly needing >=15... I just recreated a virtual environment with Python3.12 to get the newest clang. Warning:
Good:
My "good" versions all reference clang 15. |
I've just tried 3.12.0, 3.12.1, 3.11.6, 3.11.7 - all of them have Clang 13.0.0
and all of them get the same matplotlib error
On my mac I can see
So I presume the official builds are against an older compiler. I'm also guessing that some people might be getting their python from homebrew or ananconda. Could this account for the inconsistency? |
I also encountered the same issue. Python uses 13.0 instead of 15.0 (which Apple installs by default). So I guess the only way you could run Python shell with 15.0 clang is venvs. Can anyone confirm if this has to do with clang versions? |
Same warning for
No warning for
|
Since other maintainers are unable to reproduce this, could someone in this thread who can reliably reproduce this be willing to test the fix put up in #27670? I think these are the quick commands that would get a development matplotlib install working off that branch, or you can go through the devdocs for more details: https://matplotlib.org/devdocs/devel/development_setup.html Edit: easier command from the comment below: pip install git+https://github.com/greglucas/matplotlib.git@macos-app-delegate |
You don't need to install build dependencies if using a non-editable install. It should also be possible to install directly with
(but you do need a compiler at the very least) |
I got this problem too.
|
I've been able to confirm the fix in #27670 works for my setup. I did the verification as follows Checkout the fix
Setup venv to test
My test script is
My python version was downloaded from python.org
The editable installation above went through the compilation on my mac and used
|
What is the solution to fix it? |
This was fixed in #27670 and should be release in mpl 3.8.3. |
Bug summary
After updating to macOS 14, importing matplotlib generated a warning repeatably in multiple
ipython
orpython
sessions:After terminating and restarting the python environment, the warning was no longer generated.
Code for reproduction
Actual outcome
Expected outcome
In [1]: import matplotlib
Additional information
I'm using Enthought's
edm
for my Python environment. This warning happened consistently in multipleipython
sessions in the first python environment I opened after upgrading to macOS 14. After closing the shell and re-opening it, the warning is gone.This phenomenon was briefly discussed here
Operating system
macOS 14
Matplotlib Version
3.5.1
Matplotlib Backend
No response
Python version
3.8.1
Jupyter version
No response
Installation
None
The text was updated successfully, but these errors were encountered: