This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: ApplePersistenceIgnoreState warning on macOS
Type: behavior Stage:
Components: macOS Versions: Python 3.6
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: cbrnr, ned.deily, ronaldoussoren
Priority: normal Keywords:

Created on 2018-02-22 10:55 by cbrnr, last changed 2022-04-11 14:58 by admin.

Messages (3)
msg312550 - (view) Author: Clemens Brunner (cbrnr) * Date: 2018-02-22 10:55
There seems to be a problem with using certain Python packages and the application resume feature of recent macOS versions. Specifically, whenever I "import matplotlib.plyplot" or run the magic command "%matplotlib" in IPython, I get the following warning message:

2018-02-22 10:35:38.287 Python[4145:281298] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to (null)

There's an issue in the matplotlib repo (https://github.com/matplotlib/matplotlib/issues/6242), but I don't think this problem can be fixed by matplotlib. Instead, according to this SO post (https://stackoverflow.com/a/21567601/1112283), the following command fixes the behavior:

defaults write org.python.python ApplePersistenceIgnoreState NO

Since this problem also comes up with Homebrew, I created an issue (https://github.com/Homebrew/homebrew-core/issues/24424), but the maintainers indicated that (1) this might be a Python issue and should be addressed upstream, and (2) the solution above is not a real fix and the correct behavior should be implemented programmatically by Python itself.
msg312590 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2018-02-22 19:32
I don't know much about this but it seems to be due to the application Resume feature added in OS X 10.7 and has to do with the persistence of application windows.  Python itself does not create any such windows; they are created by the GUI toolkits used in Python applications, like Tk (used by the standard library tkinter) or other third-party modules that interface to other toolkits (PyQT, PyObjC, etc). I took a quick look and didn't see any application bundle keys that could be added to the Python.app Info.plist to disable persistence globally in a Python framework build and, even if there were one, I'm not sure that is desirable.  Perhaps the best way is for each tool kit to do it.  Ronald, anyone else: have any suggestions?

https://developer.apple.com/library/content/documentation/DataManagement/Conceptual/DocBasedAppProgrammingGuideForOSX/StandardBehaviors/StandardBehaviors.html
msg312621 - (view) Author: Ronald Oussoren (ronaldoussoren) * (Python committer) Date: 2018-02-23 08:23
The ApplePersistenceIgnoreState setting (either in user defaults or an info.plist file) is IMHO not the right solution, as this is a setting intended to be used for testing (see <https://developer.apple.com/library/content/releasenotes/AppKit/RN-AppKitOlderNotes/>)

I don't have time to research this fully at this time, but expect that this is something that should be fixed in GUI libraries (or possibly matplotlib).
History
Date User Action Args
2022-04-11 14:58:58adminsetgithub: 77090
2018-02-23 08:23:45ronaldoussorensetmessages: + msg312621
2018-02-22 19:32:40ned.deilysetmessages: + msg312590
2018-02-22 10:55:16cbrnrcreate