JackMcKew / pyinstaller-action-linux

Github Action for building executables with Pyinstaller for Linux
MIT License
28 stars 21 forks source link

Able to build windows package but fails for Linux #13

Closed badabing2005 closed 2 years ago

badabing2005 commented 2 years ago

Describe the bug I use pyinstaller-action-windows which builds WxPython based package successfully, However I'm running into issues building for Linux. I can build it locally on Ubuntu 20.04 but not with pyinstaller-action-linux on Github.

You can see the error here.

Building wheels for collected packages: wxPython, PyInstaller, pillow, MarkupSafe
  Building wheel for wxPython (setup.py): started
  Building wheel for wxPython (setup.py): finished with status 'error'
  error: subprocess-exited-with-error
  Running setup.py clean for wxPython

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [139 lines of output]
      /root/.pyenv/versions/3.7.5/lib/python3.7/site-packages/setuptools/dist.py:760: UserWarning: Usage of dash-separated 'license-file' will not be supported in future versions. Please use the underscore name 'license_file' instead
        % (opt, underscore_opt)
      /root/.pyenv/versions/3.7.5/lib/python3.7/site-packages/setuptools/dist.py:303: DistDeprecationWarning: use_2to3 is ignored.
        warnings.warn(f"{attr} is ignored.", DistDeprecationWarning)
      running bdist_wheel
      running build
      WARNING: Building this way assumes that all generated files have been
      generated already.  If that is not the case then use build.py directly
      to generate the source and perform the build stage.  You can use
      --skip-build with the bdist_* or install commands to avoid this
      message and the wxWidgets and Phoenix build steps in the future

To Reproduce Steps to reproduce the behavior:

  1. Clone the repository https://github.com/badabing2005/PixelFlasher
  2. Run the Action,
  3. It builds for Windows but fails for Linux.

If this is not a bug and I'm doing something wrong, I appreciate any guidance that helps me resolve this issue.

PS: Another question, is it possible to build of MacOS as well

Thanks

JackMcKew commented 2 years ago

Hi @badabing2005, thank you for the detailed issue! :)

I forked the repository in question, removed the line of hooksconfig = {} in the build-on-linux.spec file, altered the github action to run and it worked fine, so this might be the change you are seeking 👍

You can find a successful run here: https://github.com/JackMcKew/PixelFlasher/runs/5964114295?check_suite_focus=true

JackMcKew commented 2 years ago

Closing this issue, please reopen if there's any other problems :)

badabing2005 commented 2 years ago

Thanks for such a super quick turnaround.

I noticed that the generated file is only 10MB, whereas the one I build locally is 118MB And when I run the Github generated one, I get the following error.

Traceback (most recent call last):
  File "PixelFlasher.py", line 3, in <module>
    import Main
  File "/root/.pyenv/versions/3.7.5/lib/python3.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 623, in exec_module
  File "Main.py", line 3, in <module>
    import wx
ModuleNotFoundError: No module named 'wx'

Needless to say, the local build one is working. I'm assuming that it did not build / bundle wx ?

What's the solution?

Thanks

JackMcKew commented 2 years ago

From my understanding you should be able to add another bash step into your action to install wx with apt-get install wx

https://stackoverflow.com/questions/67496398/how-to-build-a-wxwidgets-program-on-github-actions

badabing2005 commented 2 years ago

Thanks for your assistance, I couldn't find a package for the current version, and my attempts at building from the source all failed.

On my local system Ubuntu 20.04 The following steps were enough, buts somehow not enough with Github actions.

sudo apt install python3-pip
sudo apt install python3.8-venv
pip install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-20.04 wxPython
sudo apt install libgtk-3-0
sudo apt-get install libnotify4
sudo apt-get install libsdl2-2.0.0
pip install -r requirements.txt
./build.sh
badabing2005 commented 2 years ago

Update: I managed to get this working. The root issue is that building wxPython from source distribution fails on the cdrx/docker-pyinstaller Docker container, which is using ubuntu:12.04

I knew that I could build it successfully on my local Ubuntu 20.04, so I build a docker pyinstaller-wxpython-linux based on Ubuntu 20.04. Then I forked this repository and made the necessary changes to use badabing2005/pyinstaller-wxpython-linux instead of cdrx/docker-pyinstaller. It worked and the results can be seen here.

Unfortunately it takes very long time to build wxPython from source, it took over 37 minutes.

Considering that there is pre-built wheel file available for Ubuntu 20.04 https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-20.04, I updated the docker image to include it (Tag: 1.1).

On my local setup that made the whole process much faster, yet when I do the same thing with Github actions, it always tries to build it from source.

By any chance is it possible that Github is caching the docker image used and is not using the updated one, even though I assigned a specific Tag 1.1 and updated the action to use that? I doubt it, but that is exactly how it is behaving,

On my local, if I build it with 1.0, it takes long and builds the wxPython just like it happens on Github, but if I build it with 1.1, it is super quick and it works as expected. But not on Github.

I can include --only-binary for wxPython; --only-binary wxPython~=4.1.1 then the generated executable does not include it, the program is 15MB instead of 120MB and of course it does not work.