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
Build app for M1 / Apple Silicon #1711
Comments
To run from source, see https://sabnzbd.org/wiki/installation/install-macos |
Ah yeah that I saw, but I meant more building an actual launchable app that could be distributed |
I know. But you could start by running from source ... because I'm very curious if that gives better performance. Check via SABnzbd's upper right corner, click on the wrench symbol ("Status and interface options"), then click on first tab Status, and therev click on the Refresh Arrow. |
Maybe in time, a Universal 2 app can be made, but for now, you can run the Intel version via Rosetta 2 or try and run from sources via AS native code. |
Okay, I'll run it from source for now and report back! |
https://www.python.org/downloads/release/python-391/ Seems like they released a version, so indeed we could build the app this way. |
I tried, but so far it seems not everything is working yet. The compiled Python packages, for example |
That's odd, I tried to run it from source and have no issues here at all. No error messages in the log either, it works as a direct 1:1 replacement for the Intel mac app. I installed python through brew though, but the formula is also just using a precompiled release. Python
Log:
Running under Apple architecture Steps:
|
Nice. Can you do something? In SABnzbd's upper right corner, click on the wrench symbol ("Status and interface options"), then click on first tab Status, and therev click on the Refresh Arrow ... what data do you get a CPU, pystones, etc? |
So yes it runs just fine from sources, but to build the App it's not just Python but also other compiled packages that need to be available for both architectures. That doesn't seem to work just yet. |
Yes, that screen. Thanks. So:
|
I'm currently stuck on a slow shared LTE network connection for another week due to some provider problems, so the speed is sadly accurate. :) Repeating the test is giving me 0.2~0.3 MB/s.
If there is anything I can help with with this, happy to help! |
I have setup this way after spending a few hours trying to get the app to work. The app was painfully slow - took forever to check files and seemed to cap my download speed at 2-4MB/s. following the source code option on the wiki I now get my full download speed. For more details of my process i have a post on reddit where i ran a few checks using the tool icon etc. All before I found this post talking about source setup. https://www.reddit.com/r/SABnzbd/comments/krajqk/mac_mini_m1_issues/ |
For now we are limited by PyInstaller, related issue: pyinstaller/pyinstaller/issues/5315 |
Weird ... because @dvcrn reported great speeds with the x86-app (no: not source) above in this thread, see #1711 (comment) |
Ah, I was running the speed tests with python compiled for M1 running sabnzbd, not the x86. Setup in #1711 (comment) I didn't experience slow-ness like @snipergotya described. I'm back on the x86 version for the time being though because of the UI integrations that running from source doesn't have. No issues here either though. Just slightly slower than running natively |
The Sab test reported great speeds. As you can see in my reddit thread. my disk speed etc was super fast. Using the source code option the thing is lightening quick, file checking is down in seconds and downloads are finished in seconds. File: xxxxx So the app when run on an M1 mac is unusable basically compare to the source code option. |
I have no issues with the x86 app running on my M1 Mac Mini through Rosetta2 here and speed-wise it's pretty much the same as when I had it hosted on my Intel Mac Mini. But I also don't have 25.3MB/s throughput here to test with... 😄 I tried grabbing a random release and get around 10 MB/s which is at the upper end of my connection
What kind of drive are you using for this? Seems a bit slow |
Not sure what was wrong with my app then. But mines completely struggled, seemed to freeze when it was unpacking files and halted the download until the unpacking was done etc. I'm just glad the source setup resolved my issues. My setup is back to normal and reliable again :) |
It looks like they just updated PyInstaller when they merged pyinstaller/pyinstaller/pull/5883 and that issue was closed 13 days ago. Thank you for all the legwork on this! |
This will still be a lot of work. Because all SABnzbd's dependencies also need to be compiled for M1. |
Just install and run from source and see what it says? The installer is one piece that you can skip by doing this. |
No worries, I'm not trying to push you on it, just wanted to update the thread about PyInstaller. I haven't run into any issues yet. I'll compare running from source vs. just running the existing package under Rosetta. Everything seems to work fine so far. |
If you try to run it natively can you report back what it errors on? (I have no clue at what libs or utilities we use even support m1 at this time) |
right now our installer wont work for m1 because pyinstaller is set to 4.2: pyinstaller added M1 support in 4.4 (2021-07-13) |
Will build a release with the new PyInstaller, it was fixed at 4.2 because 4.3 had a bug that broke all our releases. |
Current status on 20-sep-2021: |
Wonder if we could use brew to have it install/compile during the build? What do other macros GitHub builder workflows do? |
@dvcrn could you check what's listed in Activity Monitor? https://www.google.com/amp/s/www.iphonetricks.org/how-to-check-if-app-is-optimized-for-m1-mac/amp/ It's not just SABnzbd itself that needs to be adjusted, the included tools (unrar, par2, 7zip) also need to be released with universal2 binaries. Right now they are all x86, so we would also have to recompile all those. |
Oh yeah sorry, it's all Apple, not Intel anymore 👍 |
Great! So now I also wonder if it actually improves performance (faster speed, or lower cpu usage, lower battery usage), but that's quite hard to test.. |
@dvcrn What is "System performance (Pystone) " with the native M1 versus x86 ? It's under the Wrench symbol in the upper right corner of SABnzbd |
Wow, impressive performance, and impressive performance leap! |
Closing this as resolved then! |
On Windows 10/Intel I5 the Pystone fell from about 237k with 3.8 to about 195k with 3.10. The result seemed a lot more unstable as well, varying between 188k and 200k. |
@puzzledsab Not really the right issue for this, but yeah I can confirm on my Windows i7 I see the same thing. |
what if you use python 3.9 instead of 3.10 ? |
Weird, on macOS I saw a 20% increase in pystone with the latest build of 3.5.0 over 3.4.2. But that uses python.org's python, so maybe they are doing something specific with the macOS binaries. |
Yeah, just ran it again and its consistent: 3.4.2: ~100K So it's definitely a win for macOS on both Intel and ARM. |
@dvcrn could you run this new M1 build from the command line (with the |
Yes you're correct, it crashes because it can't find the arm64e files:
/EDIT: Just to add, but calls to the x86 binaries like |
@dvcrn Can you try this build? |
Finally had some time to try this. I re-ran the same experiment as last time and hit the refresh button next to the certificate, but it's crashing with the same error as before
_rust.abi3.so is still x86_64 only:
Compared to _openssl.abi3.so which is universal:
|
Actually that
|
@dvcrn Thanks for testing, I might just include that Turns out |
@dvcrn Could you try again but with: https://github.com/sabnzbd/sabnzbd/actions/runs/1490977191 ? |
Good news - everything is When repeating the certificate task I'm now getting this now:
Could be this? pyca/cryptography#5843 |
Oke next try: https://github.com/sabnzbd/sabnzbd/actions/runs/1502929891 |
Sadly still the same error. I know how annoying this is to debug without access to a M1 machine so I appreciate the many attempts. I want ahead and checked out the Can we add a Local version I built with is 3.4.2 /EDIT: maybe I could fork and make a PR so I can dick around with the CI a bit |
It's also 3.4.2: https://github.com/sabnzbd/sabnzbd/runs/4321505528?check_suite_focus=true |
Will rent a cloud M1 next week to fix this. For now I made one last attempt since I saw that
As you are not a contributor to |
After almost a full day of debugging and not understanding anything about the strange world of I ended up renting an M1 instance from Scaleways to confirm. And it works now! |
Great work @Safihre! So the suspicion that something is up with libffi was right Very happy to see a full universal build 🔥 |
Since it's just python under the hood and python already compiles on M1, how difficult would it be to package an .app for M1/ARM macs?
Are there instructions available on how to build the .app from source? Would love to give it a go
The text was updated successfully, but these errors were encountered: