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

document package build process for Windows and OSX #15

Open
eroux opened this issue Jan 2, 2025 · 6 comments
Open

document package build process for Windows and OSX #15

eroux opened this issue Jan 2, 2025 · 6 comments

Comments

@eroux
Copy link
Contributor

eroux commented Jan 2, 2025

The README should contain a Build section with some instructions to build the Windows and OSX packages

@jimk-bdrc
Copy link

The lines are in main.py.

@jimk-bdrc
Copy link

Here's a journal of my experience with pyinstaller.
First, I set up a conda environment on Python 3.12., and conda install --file requirements.txt and pip install for all the packages that conda couldn't find.

Then, in the tibetan-ocr-app directory, I repeated cycles of

  • `python -m main 2>&1 | tee main.debug.log
  • pip or conda install whatever caused the run to fail (which it did.)

When that ran, I then tried repeated cycles of pyinstaller which kept failing on:

128547 INFO: Loading module hook 'hook-PyQt5.py' from '/opt/anaconda3/lib/python3.12/site-packages/PyInstaller/hooks'...
Aborting build process due to attempt to collect multiple Qt bindings packages: attempting to run hook for 'PyQt5', while hook for 'PySide6' has already been run! PyInstaller does not support multiple Qt bindings packages in a frozen application - either ensure that the build environment has only one Qt bindings package installed, or exclude the extraneous bindings packages via the module exclusion mechanism (--exclude command-line option, or excludes list in the spec file).

So I created a spec file, from https://pyinstaller.org/en/stable/spec-files.html

❯ pyi-makespec  --debug all  --add-data="Assets:Assets" --add-data="Models:Models" main.py

Note that the Qt error is explicitly mentioned in pyinstaller hooks
So,after some tries, I edited the main.spec to have

a=Analysis( .....)
   excludes=[ 'PyQt5'],

and then

DebugBuild/main/main 2>&1 | tee main-debug.log ran and quit. The debug log showed:

RuntimeError: OpenSSL 3.0's legacy provider failed to load. This is a fatal erro
r by default, but cryptography supports running without legacy algorithms by set
ting the environment variable CRYPTOGRAPHY_OPENSSL_NO_LEGACY. If you did not exp
ect this error, you have likely made a mistake with your OpenSSL configuration.
[38724] Failed to execute script 'main' due to unhandled exception!

When I

❯ export  CRYPTOGRAPHY_OPENSSL_NO_LEGACY=yes
❯ ./DebugBuild/main/main 2>&1 | tee main.debug.log

the UI came up and was able to OCR one page at a time.

So, question:
Was it just the SSL?

Let's download the some builds and check

@eric86y
Copy link
Collaborator

eric86y commented Jan 11, 2025

So Conda is technically not needed. Everything can be set up using pip in a venv. I did most builds with the latest Python 3.11 on Windows and MacOS (15.2). On which MacOS version are you?

@jimk-bdrc
Copy link

Yes, of course it's not needed. I'm describing, not prescribing.

@jimk-bdrc
Copy link

Oh yes, 3.12 on OS 14.3 (Sonoma)

@jimk-bdrc
Copy link

jimk-bdrc commented Jan 12, 2025

Sadly, you can't use a spec file to build a windowed app, but perhaps you can train the spec file to build a windowed app with the exe section value console=False.... trying now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants