Building an EXE under Windows - nuitka

After getting to some point where I figured my small backup app was ready for a test, I wanted to build a Windows executable of some sort.
FWIW, the app (wpBG) is intended to backup my git repos by using git ‘bundles’, and it does the basic backup I expected.

Looking around, I fount the nuitka project which claims to be what I thought I needed.
Installed it and then tried to build my executable in the project root with
python -m nuitka --standalone
After a bit of churning and work, the compile finished without error and I tried to run the finished exe file after changing to .\wpBG.dist with

Traceback (most recent call last):
  File "D:\pkg\python\wpBG\wpBG.dist\", line 21, in <module>
  File "D:\pkg\python\wpBG\wpBG.dist\", line 11, in <module wpBgBase>
  File "D:\pkg\python\wpBG\wpBG.dist\wx\", line 10, in <module wx.xrc>
ModuleNotFoundError: No module named 'wx._xml'

and here I am stuck.
No idea on how to get past this stage.
As far as I know, I am not using XML directly, but who knows :slight_smile:

It seems to be a good issue to me. Most people use PyInstaller to freeze python applications into executables for distribution purposes. The nuitka is new for me and I like its different approach - to actually compile Python byte code into native machine code.
I tried to create a simple wxPython application and run into the same problem as you.

ModuleNotFoundError: No module named 'wx._xml'

Only solution, which I have found, is to explicitly include this missing module:

python -m nuitka runme.pyw --standalone --include-module=wx._xml

Honestly, I am not familiar with the nuitka yet. So maybe it is not good solution, but somehow it works for me.

nuitka is using a cache in C:\Users\admin\AppData\Local\Nuitka (sorry, I can’t get the link into here) :sneezing_face:

Thank you, I have now included the module, as you suggested, and the compile runs to a successful conclusion without errors.
But, when I try to run the command by changing to the output directory wpBG\dist\wpBG, there is some action, a frame appears and disappears very quickly.
If I open a DOS shell in wpBG\dist\wpBG, I get the same issue I have with PyInstaller:

Traceback (most recent call last):
  File "", line 31, in <module>
  File "PyInstaller\loader\", line 391, in exec_module
  File "", line 16, in <module>
ModuleNotFoundError: No module named 'git'
[17156] Failed to execute script 'wpBG' due to unhandled exception!

This happens whether I try to run the command on a DOS or PS Shell
But git.exe exists, and where finds it, at least in the DOS Shell

D:\pkg\python\wpBG\dist\wpBG>where git
C:\Program Files\Git\cmd\git.exe

So I am still stuck :frowning:

Are you a artificial intelligence…?
What modules are you including?
If there are any compile errors, what are they?
What is the command?
Are you using git and if not explain your actions.
Thank you.

Are you??? :frowning_face:

1 Like