JackMcKew / pyinstaller-action-windows

Github Action for building executables with Pyinstaller
MIT License
168 stars 67 forks source link

OSError: [WinError 126] Module not found. #34

Closed badabing2005 closed 1 year ago

badabing2005 commented 1 year ago

I've been using this module for over a year now, and today it started failing.

I can see that in previous successful builds, it pulled PyInstaller 5.9.0 whereas now it pulled PyInstaller 5.10.1 I'm not sure if it is due to that.

Traceback (most recent call last):
  File "c:\Python37\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\Python37\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Python37\Scripts\pyinstaller.exe\__main__.py", line 7, in <module>
  File "c:\Python37\lib\site-packages\PyInstaller\__main__.py", line 194, in _console_script_run
    run()
  File "c:\Python37\lib\site-packages\PyInstaller\__main__.py", line 180, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "c:\Python37\lib\site-packages\PyInstaller\__main__.py", line 61, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "c:\Python37\lib\site-packages\PyInstaller\building\build_main.py", line 978, in main
    build(specfile, distpath, workpath, clean_build)
  File "c:\Python37\lib\site-packages\PyInstaller\building\build_main.py", line 900, in build
    exec(code, spec_namespace)
  File "build-on-win.spec", line 14, in <module>
    cipher=block_cipher)
  File "c:\Python37\lib\site-packages\PyInstaller\building\build_main.py", line 424, in __init__
    self.__postinit__()
  File "c:\Python37\lib\site-packages\PyInstaller\building\datastruct.py", line 173, in __postinit__
    self.assemble()
  File "c:\Python37\lib\site-packages\PyInstaller\building\build_main.py", line 696, in assemble
    isolated.call(find_binary_dependencies, list(self.binaries), self.binding_redirects, collected_packages)
  File "c:\Python37\lib\site-packages\PyInstaller\isolated\_parent.py", line 372, in call
    return isolated.call(function, *args, **kwargs)
  File "c:\Python37\lib\site-packages\PyInstaller\isolated\_parent.py", line 302, in call
    raise RuntimeError(f"Child process call to {function.__name__}() failed with:\n" + output)
RuntimeError: Child process call to find_binary_dependencies() failed with:
  File "c:\Python37\lib\site-packages\win32ctypes\pywin32\pywintypes.py", line 35, in pywin32error
    yield
  File "c:\Python37\lib\site-packages\win32ctypes\pywin32\win32api.py", line 43, in LoadLibraryEx
    return _dll._LoadLibraryEx(fileName, 0, flags)
  File "c:\Python37\lib\site-packages\win32ctypes\core\ctypes\_util.py", line 42, in check_null
    raise make_error(function, function_name)
OSError: [WinError 126] Module not found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\Python37\lib\site-packages\PyInstaller\isolated\_child.py", line 63, in run_next_command
    output = function(*args, **kwargs)
  File "c:\Python37\lib\site-packages\PyInstaller\building\build_main.py", line 195, in find_binary_dependencies
    return bindepend.Dependencies(binaries, redirects=binding_redirects, xtrapath=extra_libdirs)
  File "c:\Python37\lib\site-packages\PyInstaller\depend\bindepend.py", line 287, in Dependencies
    for ftocnm, fn in getAssemblyFiles(pth, manifest, redirects):
  File "c:\Python37\lib\site-packages\PyInstaller\depend\bindepend.py", line 461, in getAssemblyFiles
    for assembly in getAssemblies(pth):
  File "c:\Python37\lib\site-packages\PyInstaller\depend\bindepend.py", line 415, in getAssemblies
    res = winmanifest.GetManifestResources(pth)
  File "c:\Python37\lib\site-packages\PyInstaller\utils\win32\winmanifest.py", line 979, in GetManifestResources
    return winresource.GetResources(filename, [RT_MANIFEST], names, languages)
  File "c:\Python37\lib\site-packages\PyInstaller\utils\win32\winresource.py", line 155, in GetResources
    hsrc = win32api.LoadLibraryEx(filename, 0, LOAD_LIBRARY_AS_DATAFILE)
  File "c:\Python37\lib\site-packages\win32ctypes\pywin32\win32api.py", line 43, in LoadLibraryEx
    return _dll._LoadLibraryEx(fileName, 0, flags)
  File "c:\Python37\lib\contextlib.py", line 130, in __exit__
    self.gen.throw(type, value, traceback)
  File "c:\Python37\lib\site-packages\win32ctypes\pywin32\pywintypes.py", line 37, in pywin32error
    raise error(exception.winerror, exception.function, exception.strerror)
win32ctypes.pywin32.pywintypes.error: (126, 'LoadLibraryExW', 'Module not found.')

I appreciate if you have any insights. Thanks

badabing2005 commented 1 year ago

It was indeed the PyInstaller version. Setting it to 5.9.0 worked.

Feel free to close this ticket, I'm leaving it open in case you want to make it compatible with the latest PyInstaller. I'm not sure this would be an issue with cdrx/pyinstaller-windows or this action.

Thanks for your work.

JackMcKew commented 1 year ago

I'd say it's very likely an error to do with the Docker image, and is out of my bandwidth at the moment, so PR's are most definitely welcome for this :)

badabing2005 commented 1 year ago

Thanks, Seeing that you're just using the cdrx/pyinstaller-windows docker image, the PR would have to be for that project, which seems to be 4 years old. You probably just have to reference one of the newer forks, perhaps this or this.

I'm low on bandwidth as well, but I do have to revisit this whole build aspect, to make sure my project builds fine for all platforms, which is currently broken for Linux and Macs, and I'm currently manually build those. One of these days (months ...lol), when I find some time, I will rework it all. Thanks again.

JackMcKew commented 1 year ago

I've started a new branch here where I'll try to push an image up that this action can reference python3-10-pyinstaller-5-3

It would be fantastic if you could test this when I create a stable version of the branch before merging into main

badabing2005 commented 1 year ago

Sure, I'd be happy to. Thanks

JackMcKew commented 1 year ago

Can you try your workflow please

Example:

- name: PyInstaller Windows
      uses: JackMcKew/pyinstaller-action-windows@python3-10-pyinstaller-5-3
      with:
        path: src
badabing2005 commented 1 year ago

Cool, it worked. https://github.com/badabing2005/PixelFlasher/actions/runs/4847280857/jobs/8637394909 Many thanks for the prompt fix.

MarketingPip commented 1 year ago

I'd say it's very likely an error to do with the Docker image, and is out of my bandwidth at the moment, so PR's are most definitely welcome for this :)

I'll try helping with this still. Didn't mean to leave the last issue that related to this hang so long with no progress / inputs / PRs.😴

Keep in mind - I've been trying to take a mental break last few weeks & trying to take in the moment of advancements we are experiencing in humanity.

That said - I'll take the feet down shortly and put this on my to-do list.

Other than that, I hope you're doing well @JackMcKew ✌️

DaemonDude23 commented 1 year ago

https://github.com/JackMcKew/pyinstaller-action-windows/issues/34#issuecomment-1529196967 fixed this issue for me as well.

Much thanks!