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

[python-nuitka] nuitka build of "wxhello.py" file fails when using msys2 "C:\msys64" on Windows 10 #22038

Open
2 of 7 tasks
noeldiviney opened this issue Sep 26, 2024 · 5 comments
Labels

Comments

@noeldiviney
Copy link

Description / Steps to reproduce the issue

Steps to demonstrate problem

1 Extract the attached "msys64setuo.zip" into "C:\nuitka\msys64setup"
We now have "c:\nuitka\msts64setup\msys64setup.sh" which is a Bash script to demonstrate the Nuitka problem
2 Download the MSYS2 installer by going to "https://www.msys2.org"
Scroll down to "Installation" and click on the "msys2-x86_64-20240727.exe" installer link.
Save installer to "C:\nuitka"
3 Install msys64 by double clicking "C:\nuitka\msys2-x86_64-20240727.exe"
Install to "c:/nuitka/msys64"
Click the "Finish" button to launch the msys64 terminal
4 Initialise msys64 by executing the following bash commands :-.
$ cd /c/nuitka/msys64setup/
$ ./msys64setup.sh
A restart of C:\nuitka\msys64\ucrt64.exe is required when the following output is displayed :-.
"To complete this update all MSYS2 processes including this terminal will be closed. Confirm to proceed [Y/n]"
To continue go to Step 5.
5. Restart msys64 terminal by executing "C:\nuitka\msys64\ucrt64.exe" and then entering the following bash commands.
$ cd /c/nuitka/msys64setup/
$ ./msys64setup.sh
"msys64setup.sh" will now perform the following :-.
A, Setup a MSYS2 working environment with toolchain, msys2-devel, mingw-w64-ucrt-x86_64-python3,
mingw-w64-ucrt-x86_64-python-pip, mingw-w64-ucrt-x86_64-wxPython, mingw-w64-ucrt-x86_64-python-nuitka.
B. Create a wxPython "Hello World" minimal GUI source program "wxhello.py".
C. Use the installed "C:\nuitka\msys64\ucrt64\bin\nuitka3.exe" to build "wxhello.py" as follows :-.
"nuitka3 --standalone wxhello.py --python-flag=-O" command.
D. Execute the successfully built wxhello.exe with command "./wxhello.dist/wxhello.exe"
wxhello.exe fails with "ImportError: LoadLibraryExW 'C:\nuitka\MSYS641\WXHELL1.DIS\wx_core.pyd'
failed: The specified module could not be found.
Now note the use of a single "" in 'C:\nuitka\MSYS641\WXHELL1.DIS\wx_core.pyd'
The following commands will correctly display that folder "wx" contents do exist :-
"ls -al C:\nuitka\MSYS641\WXHELL1.DIS\wx" and
"ls -al C:/nuitka/MSYS641/WXHELL1.DIS/wx"

  1. Attached files
    msys64setup.zip
    msys64setup-log.txt

Expected behavior

The wxPython wxhello.exe should display the GUI sucessfully

Actual behavior

wxhello.exe fails with the following error:-
Line 179 msys2.bash Executing ./wxhello.dist/wxhello.exe
Traceback (most recent call last):
File "C:\nuitka\MSYS641\WXHELL1.DIS\wxhello.py", line 7, in
File "C:\nuitka\MSYS641\WXHELL1.DIS\wx/init.py", line 17, in
File "C:\nuitka\MSYS641\WXHELL1.DIS\wx/core.py", line 12, in
ImportError: LoadLibraryExW 'C:\nuitka\MSYS641\WXHELL1.DIS\wx_core.pyd' failed: The specified module could not be found.

Verification

Windows Version

MINGW64_NT-10.0-19045

MINGW environments affected

  • MINGW64
  • MINGW32
  • UCRT64
  • CLANG64
  • CLANG32
  • CLANGARM64

Are you willing to submit a PR?

I would like to

@Biswa96
Copy link
Member

Biswa96 commented Sep 26, 2024

@podsvirov Would you like to look into this issue, please?

@podsvirov
Copy link
Collaborator

@noeldiviney, I experience similar problems when exporting PySide projects too... But this is, in many ways, the problem of nuitka itself, and not the msys2 distribution.
Support for the msys2 distribution is getting better release by release. Feel free to submit your bug reports or pull requests in the Nuitka repository.

@noeldiviney
Copy link
Author

noeldiviney commented Sep 27, 2024

Thanks guys for your responses.
I had actually raised Issue #3112 on the nuitka issue tracker 3 weeks ago but no response as yet!
As the nuitka installed from the prebuilt binaries is at version 2.1.6 I have updated nuitka to version 2.4.8 (The latesr).
The wxhello.exe still fails with same "error".
I have updated nuitka error #3112 to reflect this and I now await a response.

I notice that Nuitka makes no mention of supporting MSYS64 so perhaps it would help if you indicate you have a similar issue.

The Install command in the 'build from source' documentation needs to be updated from
pacman -U ${package-name}*.pkg.tar.xz to pacman -U ${package-name}*.pkg.tar.zst

The binary that is built is named 'mingw-w64-x86_64-python-nuitka-2.4.8-2-any.pkg.tar.zst'
Note the 'tar' ending is now '.zst'

Any plans to bring the default nuitka binary to version 2.4.8?

Thank you for creating MSYS2.
Noel Diviney

@noeldiviney
Copy link
Author

Hi @Biswa96 @podsvirov
Great news from Nuitka @kayheyen
The problem is now fixed in the factory branch.
So we hould have a new version release shortly.
This makes very happy as I find msys64 on Windows 10 gives me a nice Embedded Systems Development Eivironment
for my projects.
Best regards Noel Diviney.

@podsvirov
Copy link
Collaborator

As an alternative, I suggest trying the pyinstaller package with similar functionality that we recently added.

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

No branches or pull requests

3 participants