Daan Breur
Daan Breur

Reputation: 523

Unable to install and use pyinstaller inside of github actions

I am trying to install pyinstaller inside of my github actions workflow. Using pip install pyinstaller was fine on ubuntu-latest but on windows-latest it was not however. It returns the following log.

Requirement already satisfied: future in c:\hostedtoolcache\windows\python\3.9.12\x64\lib\site-packages (from pefile>=2017.8.1->pyinstaller) (0.18.2)
Using legacy 'setup.py install' for pefile, since package 'wheel' is not installed.
Installing collected packages: pywin32-ctypes, altgraph, pyinstaller-hooks-contrib, pefile, pyinstaller
  Running setup.py install for pefile: started
ERROR: Operation cancelled by user
  Running setup.py install for pefile: finished with status 'canceled'
Error: The operation was canceled.
  build:
    name: Build Executables
    needs: create_release
    runs-on: ${{ matrix.config.os }}
    strategy:
      matrix:
        config:
          - os: ubuntu-latest
          - os: macos-latest
          - os: windows-latest
    steps:
      - uses: actions/checkout@v3
      - name: Setup Python
        uses: actions/setup-python@v3
        with:
          python-version: '3.9.12'
      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          pip install -r requirements.txt
          pip install pyinstaller
      - name: Build with pyinstaller for ${{ matrix.config.os }}
        run: pyinstaller game.spec

Direct link to github action file: https://github.com/daanbreur/SwishandFrick/blob/main/.github/workflows/build.yml

Trying to install the missing dependencies manually doesnt resolve the issue however

      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip wheel setuptools
          pip install -r requirements.txt
          pip install pywin32 pefile pyinstaller

Direct link to github action file: https://github.com/daanbreur/SwishandFrick/blob/main/.github/workflows/build.yml

ubuntu-latest fails to locate the pywin32 package

Installing collected packages: PyTMX, pygame, future, pyscroll
Successfully installed PyTMX-3.31 future-0.18.2 pygame-2.1.2 pyscroll-2.29
ERROR: Could not find a version that satisfies the requirement pywin32 (from versions: none)
ERROR: No matching distribution found for pywin32
Error: Process completed with exit code 1.

And windows-latest crashes entirely

Run python -m pip install --upgrade pip wheel setuptools
  pip install -r requirements.txt
  pip install pywin32 pefile pyinstaller
Traceback (most recent call last):
  File "C:\hostedtoolcache\windows\Python\3.9.12\x64\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\hostedtoolcache\windows\Python\3.9.12\x64\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\hostedtoolcache\windows\Python\3.9.12\x64\lib\site-packages\pip\__main__.py", line 29, in <module>
    from pip._internal.cli.main import main as _main
  File "C:\hostedtoolcache\windows\Python\3.9.12\x64\lib\site-packages\pip\_internal\cli\main.py", line 9, in <module>
    from pip._internal.cli.autocompletion import autocomplete
  File "C:\hostedtoolcache\windows\Python\3.9.12\x64\lib\site-packages\pip\_internal\cli\autocompletion.py", line 10, in <module>
    from pip._internal.cli.main_parser import create_main_parser
  File "C:\hostedtoolcache\windows\Python\3.9.12\x64\lib\site-packages\pip\_internal\cli\main_parser.py", line 8, in <module>
    from pip._internal.cli import cmdoptions
  File "C:\hostedtoolcache\windows\Python\3.9.12\x64\lib\site-packages\pip\_internal\cli\cmdoptions.py", line 23, in <module>
    from pip._internal.cli.parser import ConfigOptionParser
  File "C:\hostedtoolcache\windows\Python\3.9.12\x64\lib\site-packages\pip\_internal\cli\parser.py", line 12, in <module>
    from pip._internal.configuration import Configuration, ConfigurationError
  File "C:\hostedtoolcache\windows\Python\3.9.12\x64\lib\site-packages\pip\_internal\configuration.py", line 20, in <module>
    from pip._internal.exceptions import (
  File "C:\hostedtoolcache\windows\Python\3.9.12\x64\lib\site-packages\pip\_internal\exceptions.py", line 13, in <module>
    from pip._vendor.requests.models import Request, Response
  File "C:\hostedtoolcache\windows\Python\3.9.12\x64\lib\site-packages\pip\_vendor\requests\__init__.py", line 45, in <module>
    from .exceptions import RequestsDependencyWarning
  File "C:\hostedtoolcache\windows\Python\3.9.12\x64\lib\site-packages\pip\_vendor\requests\exceptions.py", line 11, in <module>
    from .compat import JSONDecodeError as CompatJSONDecodeError
  File "C:\hostedtoolcache\windows\Python\3.9.12\x64\lib\site-packages\pip\_vendor\requests\compat.py", line 11, in <module>
    from pip._vendor import chardet
  File "C:\hostedtoolcache\windows\Python\3.9.12\x64\lib\site-packages\pip\_vendor\chardet\__init__.py", line 19, in <module>
    from .universaldetector import UniversalDetector
  File "C:\hostedtoolcache\windows\Python\3.9.12\x64\lib\site-packages\pip\_vendor\chardet\universaldetector.py", line 46, in <module>
    from .latin1prober import Latin1Prober
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 846, in exec_module
  File "<frozen importlib._bootstrap_external>", line 941, in get_code
  File "<frozen importlib._bootstrap_external>", line 1040, in get_data
KeyboardInterrupt

What am I missing for windows and how can I let ubuntu skip the step for windows dependencies.

Upvotes: 1

Views: 1576

Answers (1)

Daan Breur
Daan Breur

Reputation: 523

Big oops on my part. Windows didn't fail to install the dependencies, Ubuntu failed to zip the archive and that lead to it erroring. By default is configured to automatically cancel all other jobs in the matrix. Setting fail-fast inside the strategy to false stops it from canceling other jobs. See docs: jobs.<job_id>.strategy.fail-fast

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index a00be16..34b9e82 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -38,6 +38,7 @@ jobs:
     needs: create_release
     runs-on: ${{ matrix.config.os }}
     strategy:
+      fail-fast: false
       matrix:
         config:
           - os: ubuntu-latest
@@ -49,11 +50,11 @@ jobs:
         uses: actions/setup-python@v3
         with:
           python-version: '3.9.12'
-      - name: Install dependencies
+      - name: Install dependencies for ${{ matrix.config.os }}
         run: |
           python -m pip install --upgrade pip wheel setuptools
           pip install -r requirements.txt
-          pip install pywin32 pefile pyinstaller
+          pip install pyinstaller
       - name: Build with pyinstaller for ${{ matrix.config.os }}
         run: pyinstaller game.spec
       - name: Archive Release

Upvotes: 3

Related Questions