Good day,
This topic is old, I know, but instead of start a new topic with the “same” intentions, I rather not duplicate things, to keep some sense of order.
Well, I’ve been searching for ways of doing things on Haiku with Python and decided to try Nuitka, which is, as @Pahefu said, a system to pack a python app into a binary that is executable, thus can have its own icon and attributes, even on the deskbar instead of the PythonX.Y icon.
The indication provided by @Pahefu might be good for old versions of Nuitka, as I wasn’t able to succeed with his notes, no such file inside new Nuitka. I digged and digged and found the new issue.
What I did was:
1- install Python 3.8 from HaikuDepot
2- install PyQt5 and PyQt5-Python3.8 [that’s the reason for installing Python 3.8?] from HaikuDepot in order to create some GUI apps [the Haiku Python API is a harder task to achive… maybe later will get enough courage to start to face it]
3- checking Nuitka’s requirements, it needs a C compiler [GCC or Clang], Haiku has already GCC, so nothing here; and also SCons, so installed Scons from HaikuDepot
4- created a testing folder ‘testing’, inside created a python environment ‘python3.8 -m venv penv --system-site-packages’ in order to have PyQt5 in the environment. Never succeeded to install PyQt5 with ‘pip’. Updated pip, and created a simple PyQt5 file, ‘test.py’ [just a plain PyQt widget].
5- inside the python environment [Terminal] installed nuitka ‘python -m pip install nuitka’ which installed without issues.
6- tested the python file inside the environment certifying it works. Then call [inside the environment] call ‘python -m nuitka test.py’ and wait.
The first time I did it it complained that could not find the Python.h header file inside /boot/system/include/Python3.8. Neither could I, so was going to ask for help in this forum when the topic by @pahefu came up. Tried his approach, didn’t work. So digging found the file, ‘Backend.scons’, inside the environment ‘penv/non-packaged/lib/python3.8/site-packages/nuitka/build/Backend.scons’. There in the method ‘_detectPythonHeaderPath’ added a candidate path [hardcoded]: ‘/system/develop/headers/python3.8’ and rerun ‘python -m nuitka test.py’. This time success:
It’s a simple test of course. Now need more testing and with some proper applications.
Anyway, spent so much time doing research to end up finding an old topic here. In the end, it turns out that Nuitka’s requirements are easy to fulfill and might be a good option to package python apps [PyQt at the moment] for Haiku.
In the screenshot the executable is called ‘test.bin’, but the ‘.bin’ can be removed, of course.
Terminal shows the Error at the top ‘dependency not satisfied’ before I found the Backend.scons issue. No icon on the deskbar yet.
Hope you find this useful. I’ll have to get my fingers in shape to start doing some serious learning.
Regards,
RR