-
Notifications
You must be signed in to change notification settings - Fork 151
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
ffi.callback() issues in code-signed, notarized MacOS app #270
Comments
Oh, this looks like it's going to be a gnarly wee problem. I added the required entitlement. And sure enough the error went away... only to be replaced with:
I looked up that error number (in Any, even vague, ideas? I suspect I'm heading toward these new style callbacks rather than going down this current path. |
That's unfortunate ... I've not experienced those error messages because I'm using Linux.
No, sorry.
I don't have any experience with the new style callbacks per se, but I guess the main obstacle will be that they only work in API mode, right? Currently, we are using out-of-line ABI mode. Switching to API mode is a possibility, but I guess it would be a major undertaking, see #91. |
Thanks for your comments. Given the contents of thread you linked to, I'll be very hesitant to even try to make that conversion to the new callback style. Thank you for the heads up. Interestingly, I was unable to replicate the error Thanks again. |
OK, so let's postpone the API-mode discussion ... I guess it would be good to add instructions for the macOS settings, though? Would you like to make a PR for this? |
Where would you see such documentation being added? It's not really appropriate for the "installation" section, as that's more for development. Perhaps there needs to be a "packaging" section? But I'm not sure how much there would be to write. I believe the advice applies only to "frozen" packages and my experience is currently limited only to PyInstaller on the Mac. However, I will soon be looking into the process under Windows. If you wish your application to run on Catalina (OSX 10.15), you will need to specify the appropriate entitlements, code-sign, and then notarize the application. To allow sounddevice's callbacks, your application will require the If your application uses the microphone, you will need to specify the entitlement I do not know if the first entitlement is incompatible with Apple's sandboxing requirements for the App Store, however the combination of the above entitlements at least allows you to distribute the application yourself. Would you like more detail than that? It's quite an elaborate process actually, but most of it is not sounddevice-specific. |
I don't know. I was hoping you had an idea.
Ah, now this is interesting! So the problems you were describing all that time only happen when packaging? They don't happen when installing the module with If that's the case, I think we can either make a completely new documentation page (if there is a lot of information), or just add a little section to "Contributing".
Is this also the case when simply
I personally am not a Mac user, so I don't need that information, but I think it would be nice to provide help to other macOS users. Or users of any OS, for that matter. I have no clue whether anybody actually need this, though ... |
Correct. The problems listed in this thread are exclusively to do with frozen, code-signed, and notarized apps for MacOS. There are no issues when sounddevice is used with a pip-install.
No. Sounddevice runs out-of-the-box without issue with a pip-install.
Are you aware that there's a specific sounddevice hook in PyInstaller? I had assumed you'd provided it. I've just found the original pull request; looks like my assumptions were wrong :o) I think it's certainly safe to say that other people use sounddevice with PyInstaller and if they use it on a Mac with OSX10.15 on it then they'll have the issues I did. |
Thanks for the clarification! Can you please update the issue title to say that only applies to frozen macOS apps (or whatever is the proper term)?
Yes.
No, it was provided by someone else here (as you have found out yourself): pyinstaller/pyinstaller#4498 See also: #130 (comment) However, in the meantime the "hooks" seem to have been removed from the main PyInstaller repo and moved to https://github.com/pyinstaller/pyinstaller-hooks-contrib. The |
I'm trying to install From a vscode juypter notebook and still having problems, I've done the following:
I get:
also tried
conda info:
|
Sorry, I don't really know anything about this, but I recently released a new version which includes a |
Hi,
Do you have any experience with this error message?
builtins.MemoryError: Cannot allocate write+execute memory for ffi.callback(). You might be running on a system that prevents this. For more information, see https://cffi.readthedocs.io/en/latest/using.html#callbacks
I've spent all week dealing with the joys of code signing my work for macOS, only for this error to show its head on Friday evening.
One option looks to be just to accept that this code is dangerous and to apply the work around of giving my application the entitlement
com.apple.security.cs.allow-unsigned-executable-memory
. Maybe for a demo that sounds like a sufficient approach, but Apple's not exactly all roses over this: "Including this entitlement exposes your app to common vulnerabilities in memory-unsafe code languages. Carefully consider whether your app needs this exception." CFFI is even less positive:Another option is to look into converting sounddevice to the new style callbacks.
Regarding these new style callbacks, do you have any advice/feedback/experience/bald patches from already pulling your hair out over this?
Cheers,
Matthew
The text was updated successfully, but these errors were encountered: