Skip to content
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

Add native Apple Silicon support by upgrading qt5 to qt6 #523

Merged
merged 38 commits into from
Jan 2, 2024

Conversation

axu2
Copy link
Collaborator

@axu2 axu2 commented May 22, 2023

I upgraded to pyside6 which has native Apple Silicon support. (aka a vanilla pip install pyside6 works).

My process was:

  1. Install PySide6 and run
    gen_ui_files.sh
  2. python kcc.py
  3. Fix the error with a change all occurences replacement.
  4. Repeat

Porting to PySide6 is actually easier than PyQT6 since PyQT6 dropped pyrcc. PySide6 is also the official library now.

Note that KCC_rcc.py, KCC_ui.py, KCC_ui_editor.py, were autogenerated by pyside6-uic and pyside6-rcc

KCC_gui.py was manually edited.

image

This has been the base for testing all my other PRs on Mac, extensively tested.

@axu2 axu2 changed the title Add native Apple Silicon support Add native Apple Silicon support via pyqt6 May 22, 2023
@darodi
Copy link
Collaborator

darodi commented May 22, 2023

The main problem here is that the apple silicon is not supported via github actions.
So it's not included in our automatic build/release process.

pyqt5 is available and works during build.
see: darodi#4

https://github.com/celogeek/go-comic-converter might be a better solution, it can compile on every platform

but I admit that migrating to pyqt6 (or even another GUI?) will be needed in the end.

@darodi
Copy link
Collaborator

darodi commented May 22, 2023

Note for later,
if the dependency changes from pyqt5 to pyqt6, also adapt all github actions/builds and docker files

@darodi darodi added Enhancement New feature or request GUI dependencies Pull requests that update a dependency file documentation Improvements or additions to documentation Docker Docker image labels May 22, 2023
@axu2 axu2 closed this Jun 29, 2023
@axu2 axu2 changed the title Add native Apple Silicon support via pyqt6 Add native Apple Silicon support via pyside6 Jun 30, 2023
@axu2 axu2 reopened this Jun 30, 2023
@darodi
Copy link
Collaborator

darodi commented Aug 11, 2023

beta release here
https://github.com/darodi/kcc/releases/tag/v5.7.0b1

Windows is ok
I'm trying appImage now and docker
No apple to test dmg. Can you try @axu2 ?

@darodi
Copy link
Collaborator

darodi commented Aug 11, 2023

appImage is broken

(user@linux kcc-appImage)$ ./kindleComicConverter-latest-x86_64.AppImage 
Traceback (most recent call last):
  File "kcc.py", line 74, in <module>
  File "kindlecomicconverter/startup.py", line 29, in start
  File "PyInstaller/loader/pyimod02_importers.py", line 385, in exec_module
  File "kindlecomicconverter/KCC_gui.py", line 30, in <module>
ImportError: libQt6Widgets.so.6: cannot open shared object file: No such file or directory
[13995] Failed to execute script 'kcc' due to unhandled exception!

@axu2
Copy link
Collaborator Author

axu2 commented Aug 11, 2023

Works fine on Apple.
image

Surprisingly, the UI is now a lot smoother with pyside6 via Rosetta, the pyqt5 was a little sluggish when running through Rosetta.

I don't have any Linux to test.

@darodi
Copy link
Collaborator

darodi commented Aug 11, 2023

Docker image is fine on platform=linux/amd64


user@wsl:/mnt/c/Users/rodi_/workspace/mangas/testmanga$ docker run --rm -v "$(pwd):/app" ghcr.io/darodi/kcc:5.7.0b1 -p KPW5 ./test
comic2ebook v5.7.0b1 - Written by Ciro Mattia Gonano and Pawel Jastrzebski.
Working on ./test...
Preparing source images...
Checking images...
Processing images...
Creating EPUB file...
Creating MOBI files...

and mobi output can be read

@darodi
Copy link
Collaborator

darodi commented Aug 11, 2023

so just the appImage to fix. I'll have a look.

@darodi
Copy link
Collaborator

darodi commented Aug 11, 2023

docker is broken on platform=linux/arm/v7

user@amrv7 docker # docker run --rm -v "$(pwd):/app" ghcr.io/darodi/kcc:5.7.0b1 -p KPW5 ./test
ERROR: psutil 5.0.0+, python-slugify 1.2.1+, Pillow 5.2.0+ is not installed!

@axu2
Copy link
Collaborator Author

axu2 commented Aug 11, 2023

I did bump the psutil version due to security but maybe I bumped it too high?

@darodi
Copy link
Collaborator

darodi commented Aug 12, 2023

I'll have a look and update the Docker image next week

@axu2
Copy link
Collaborator Author

axu2 commented Oct 16, 2023

@darodi
Copy link
Collaborator

darodi commented Nov 29, 2023

@axu2

I've been able to make the appImage work with pyqt6 and python 3.12
However, kindlegen is not found, even if present in the same directory.

@axu2
Copy link
Collaborator Author

axu2 commented Nov 29, 2023

@darodi

On posix isn't it supposed to be in '/usr/local/bin'?

'kcc.py' modifies PATH for 7z/kindlegen on win/mac

@darodi
Copy link
Collaborator

darodi commented Nov 29, 2023

same problem with version 5.6.2 in fact
/usr/local/bin is a read only file system on the steam deck
I'll try with another machine

Repository owner deleted a comment from darodi Dec 4, 2023
@axu2 axu2 changed the title Add native Apple Silicon support for development via pyside6 Add native Apple Silicon support by upgrading qt5 to qt6 Dec 5, 2023
@axu2 axu2 merged commit ee31b78 into ciromattia:master Jan 2, 2024
@axu2 axu2 deleted the pyqt6 branch January 2, 2024 22:08
@kgantchev
Copy link

@axu2

Edit: not free yet

FlyCI has M1 and M2 runners with a free tier for M1s. Our runners are on average 2x faster and 2x cheaper than GitHub's.

Install Instructrions

Easily replace your M1 runners:

jobs:
 ci:
-    runs-on: macos-latest
+    runs-on: flyci-macos-large-latest-m1
   steps:
   - name: 👀 Checkout repo
     uses: actions/checkout@v4

Or try the M2 runners:

jobs:
  ci:
-    runs-on: macos-latest
+    runs-on: flyci-macos-large-latest-m2
    steps:
      - name: 👀 Checkout repo
        uses: actions/checkout@v4

Pricing

Processor vCPU RAM (GB) Storage Label Price on FlyCI Price on GitHub
M1 4 7 28 GB flyci-macos-large-latest-m1 $0.06 -
M1 8 14 28 GB flyci-macos-xlarge-latest-m1 $0.12 $0.16
M2 4 7 28 GB flyci-macos-large-latest-m2 $0.08 -
M2 8 14 28 GB flyci-macos-xlarge-latest-m2 $0.16 -

500 mins/month Free for Public Repos

If your repo is public, then FlyCI offers 500 mins/month of free M1 runner usage with the flyci-macos-large-latest-m1 runner.

Best Regards,
Kiril Gantchev
CEO and co-founder of FlyCI

This was referenced Jan 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file Docker Docker image documentation Improvements or additions to documentation Enhancement New feature or request GUI macOS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Kindle Comic Converter - Native Apple Silicon
4 participants