Giter VIP home page Giter VIP logo

pyinstaller-action-linux's Introduction

PyInstaller-Action-Linux

Github Action for building executables with PyInstaller for running on Linux

To build your application, you need to specify where your source code is via the path argument, this defaults to src.

The source code directory should have your .spec file that PyInstaller generates. If you don't have one, you'll need to run PyInstaller once locally to generate it. Also if you have another program .spec file you can set specific pyinstaller .spec file by spec: <YOUR_SPEC_FILE_NAME>

If the src folder has a requirements.txt file, the packages will be installed into the environment before PyInstaller runs.

If you wish to specify a package mirror, this is possibly via the pypi_url and/or the pypi_index_url, these defaults are:

  • pypi_url = https://pypi.python.org/
  • pypi_index_url = https://pypi.python.org/simple

If the application requires Tkinter, ensure to use the tkinter branch of this repository (eg JackMcKew/pyinstaller-action-linux@tkinter), as this will undergo the steps to install tkinter and please set the tkinter argument to true (this is under the with similar to how path is defined). Note that this will slow the action down considerably as Python will need to be uninstalled & rebuilt once tkinter is installed

If you are using the default Python gitignore file, ensure to remove .spec

Example usage

Include this in your .github/workflows/main.yaml:

- name: PyInstaller Linux
  uses: JackMcKew/pyinstaller-action-linux@main
    with:
      path: src

Full Example

Here is an entire workflow for:

  • Packaging an application with PyInstaller
  • Uploading the packaged executable as an artifact
name: Package Application with Pyinstaller

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2

    - name: Package Application
      uses: JackMcKew/pyinstaller-action-linux@main
      with:
        path: src

    - uses: actions/upload-artifact@v2
      with:
        name: name-of-artifact
        path: src/dist/linux

Python 3.10

If you are running into problems, please try using the branch python3.10:

- name: PyInstaller Linux
      uses: JackMcKew/[email protected]
      with:
        path: src

Sources

A big thank you to all the contributors over at https://github.com/cdrx/docker-pyinstaller, this action is just a modified version of their docker container, thank you!

pyinstaller-action-linux's People

Contributors

hedjour avatar jackmckew avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

pyinstaller-action-linux's Issues

ModuleNotFoundError: No module named 'requests'

Hello,

This Github action successfully compiles the script and generates binary file but running the binary file throws following error:
ModuleNotFoundError: No module named 'requests'

Here is my requirements.txt:

...
requests # Installed as dependency for yfinance, cachecontrol
...

Here is my .spec file: https://github.com/pranjal-joshi/Screeni-py/blob/pre-main/src/screenipy.spec

Observation: Also I've observed that size of compiled binaries is very small (approx 6MB). However, the size of compiled binary on my local machine is around 31MB which is working fine without any error.

Kivy support

I cannot get kivy to compile, it works fine for the windows version of this, but not for linux. I get
ERROR: Could not build wheels for Kivy, which is required to install pyproject.toml-based projects which is probably caused by GL/gl.h: No such file or directory. Google seems to think I need to install libgl1-mesa-dev but I could not get it too install on my side. A flag like the tkinter one probably work if you don't want it to install for everyone who may not need it, but kivy is also big enough to justify dedicating its own flag.

Able to build windows package but fails for Linux

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

Base docker image is trying to pull packages from ancient and defunct Ubuntu repository.

Describe the bug

Base docker image is trying to pull packages from ancient and defunct Ubuntu repository.

Ign http://archive.ubuntu.com precise Release.gpg
Ign http://archive.ubuntu.com precise-updates Release.gpg
Ign http://archive.ubuntu.com precise-security Release.gpg
Ign http://archive.ubuntu.com precise Release
Ign http://archive.ubuntu.com precise-updates Release
Ign http://archive.ubuntu.com precise-security Release
Err http://archive.ubuntu.com precise/main Sources
  404  Not Found [IP: 91.189.88.142 80]
Err http://archive.ubuntu.com precise/restricted Sources
  404  Not Found [IP: 91.189.88.142 80]
Err http://archive.ubuntu.com precise/universe Sources
  404  Not Found [IP: 91.189.88.142 80]
Err http://archive.ubuntu.com precise/main amd64 Packages
  404  Not Found [IP: 91.189.88.142 80]
Err http://archive.ubuntu.com precise/restricted amd64 Packages
  404  Not Found [IP: 91.189.88.142 80]
Err http://archive.ubuntu.com precise/universe amd64 Packages
  404  Not Found [IP: 91.189.88.142 80]
Err http://archive.ubuntu.com precise/main i386 Packages
  404  Not Found [IP: 91.189.88.142 80]
Err http://archive.ubuntu.com precise/restricted i386 Packages
  404  Not Found [IP: 91.189.88.142 80]
Err http://archive.ubuntu.com precise/universe i386 Packages
  404  Not Found [IP: 91.189.88.142 80]
Err http://archive.ubuntu.com precise-updates/main Sources
  404  Not Found [IP: 91.189.88.142 80]
Err http://archive.ubuntu.com precise-updates/restricted Sources
  404  Not Found [IP: 91.189.88.142 80]
Err http://archive.ubuntu.com precise-updates/universe Sources
  404  Not Found [IP: 91.189.88.142 80]
Err http://archive.ubuntu.com precise-updates/main amd64 Packages
  404  Not Found [IP: 91.189.88.142 80]
Err http://archive.ubuntu.com precise-updates/restricted amd64 Packages
  404  Not Found [IP: 91.189.88.142 80]
Err http://archive.ubuntu.com precise-updates/universe amd64 Packages
  404  Not Found [IP: 91.189.88.142 80]
Err http://archive.ubuntu.com precise-updates/main i386 Packages
  404  Not Found [IP: 91.189.88.142 80]
Err http://archive.ubuntu.com precise-updates/restricted i386 Packages
  404  Not Found [IP: 91.189.88.142 80]
Err http://archive.ubuntu.com precise-updates/universe i386 Packages
  404  Not Found [IP: 91.189.88.142 80]
Err http://archive.ubuntu.com precise-security/main Sources
  404  Not Found [IP: 91.189.88.142 80]
Err http://archive.ubuntu.com precise-security/restricted Sources
  404  Not Found [IP: 91.189.88.142 80]
Err http://archive.ubuntu.com precise-security/universe Sources
  404  Not Found [IP: 91.189.88.142 80]
Err http://archive.ubuntu.com precise-security/main amd64 Packages
  404  Not Found [IP: 91.189.88.142 80]
Err http://archive.ubuntu.com precise-security/restricted amd64 Packages
  404  Not Found [IP: 91.189.88.142 80]
Err http://archive.ubuntu.com precise-security/universe amd64 Packages
  404  Not Found [IP: 91.189.88.142 80]
Err http://archive.ubuntu.com precise-security/main i386 Packages
  404  Not Found [IP: 91.189.88.142 80]
Err http://archive.ubuntu.com precise-security/restricted i386 Packages
  404  Not Found [IP: 91.189.88.142 80]
Err http://archive.ubuntu.com precise-security/universe i386 Packages
  404  Not Found [IP: 91.189.88.142 80]

To Reproduce
Steps to reproduce the behavior:

  1. Prepare github action workflow
    - name: Package Application
      uses: JackMcKew/pyinstaller-action-linux@tkinter
      with:
        path: src
  1. See error

Not loading tkinter module

Describe the bug
I have a python script that uses tkinter to provide a simple file dialog and message box. When I test and build locally with pyinstaller to generate the spec file, the executable works fine. building in the github action succeeds, but the executable created doesn't work, giving the error:

Traceback (most recent call last):
  File "tcg-to-deckbox.py", line 6, in <module>
  File "/root/.pyenv/versions/3.7.5/lib/python3.7/site-packages/PyInstaller/loader/pyimod03_importers.py", line 623, in exec_module
  File "tkinter/__init__.py", line 36, in <module>
ModuleNotFoundError: No module named '_tkinter'

To Reproduce
I ran with the following github action flow


# This is a basic workflow to help you get started with Actions

name: CI

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
# additionally allows a manual trigger via workflow_dispatch
on:
  workflow_dispatch:
    types: ManualUpdate
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  # This workflow contains a single job called "build"
  build:
    # The type of runner that the job will run on
    runs-on: ubuntu-latest

    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
    # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
    - uses: actions/checkout@v2
      
    - name: PyInstaller Linux
      uses: JackMcKew/[email protected]
      with:
        path: src

    - uses: actions/upload-artifact@v2
      with:
        name: tcg-to-deckbox
        path: src/dist/linux

successful.log
failure_logs_17.zip

As you'll note from the attached logs, the one where the executable functions has the line 3120 INFO: Loading module hook 'hook-_tkinter.py' from '/home/rspremulli/.local/lib/python3.6/site-packages/PyInstaller/hooks'... while the github action doesn't. Is there some issue why it won't load the tkinter module?

ModuleNotFoundError: No module named 'PyQt5.sip'

My code contains PyQt5, I've successfully build it but when I tried to launch the executable file through terminal, this error showed up:
Traceback (most recent call last): File "main.py", line 1, in <module> ModuleNotFoundError: No module named 'PyQt5.sip' [8402] Failed to execute script main

Here is an example to reproduce the bug

  1. Fork https://github.com/ftharyanto/excel-merger
  2. Apply some changes on the main branch
  3. Push and wait until the the Github Action finished
  4. Download and run the artifact

/entrypoint.sh: line 41: pip: command not found

I've set up a mini python project w/ everything under the root directory & the standard Python application workflow + pyinstaller-action-linux.

Then I got the following error while running the step Package Application:

Run JackMcKew/pyinstaller-action-linux@main
  with:
    path: .
    pypi_url: https://pypi.python.org/
    pypi_index_url: https://pypi.python.org/simple
  env:
    pythonLocation: /opt/hostedtoolcache/Python/3.8.5/x64
/usr/bin/docker run --name cbfc173e8ff88d40fdaedd3eb49ee07891_c6a113 --label 8118cb --workdir /github/workspace --rm -e pythonLocation -e INPUT_PATH -e INPUT_PYPI_URL -e INPUT_PYPI_INDEX_URL -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e RUNNER_OS -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/volksschule/volksschule":"/github/workspace" 8118cb:fc173e8ff88d40fdaedd3eb49ee07891  "." "https://pypi.python.org/" "https://pypi.python.org/simple"
/entrypoint.sh: line 41: pip: command not found

I've tried both release 0.1.0 & main. Both had the same error.

pip fails installing packages due to incorrect python version

Describe the bug
When this action attempts to install packages that require a later version of Python, pip fails, stopping the whole action.

To Reproduce
Steps to reproduce the behavior:

  1. In the project's requirements.txt file, include a package that does not run on Python versions prior to 3.8 (e.g. nextcord).
  2. Attempt to run the workflow.

Expected behavior
The action completes successfully.

Error message

ERROR: Could not find a version that satisfies the requirement nextcord==2.0.0a3 (from versions: none)
ERROR: No matching distribution found for nextcord==2.0.0a3

Additional context
If there was a way to change which version of Python gets used, this would resolve the issue, as some projects only support the more recent versions of Python (e.g. my project expects 3.9 to be present).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.