Pyinstaller fails to find kernel32 dll

Viewed 90

Currently trying to build a exe using PyInstaller. The installation goes fine, although when trying to run the exe an exception occurs

Exception ignored in: <function Library.__del__ at 0x000002126637F160>
Traceback (most recent call last):
  File "C:\Users\blah\AppData\Local\Programs\Python\Python39\lib\site-packages\pylink\library.py", line 272, in __del__
  File "C:\Users\blah\AppData\Local\Programs\Python\Python39\lib\site-packages\pylink\library.py", line 390, in unload
  File "C:\Users\blah\AppData\Local\Programs\Python\Python39\lib\ctypes\__init__.py", line 444, in __getattr__
  File "PyInstaller\loader\pyimod04_ctypes.py", line 79, in __init__
pyimod04_ctypes.install.<locals>.PyInstallerImportError: Failed to load dynlib/dll 'kernel32'. Most likely this dynlib/dll was not found when the application was frozen.

I've followed the lead on some other posts and ensured the Visual C++ Redistributables are installed and also included --hidden-import ctypes in the build to no avail.

Building on Windows 10 - Python 3.9 - PyInstaller 5.0.1

Any help would be great!

1 Answers

Taken from the comments on the original answer. Quote stevod:

I ended up finding the problem, our company anti virus wouldn't let the bootloader access the required files, so we had to rebuild the bootloader manually and then it worked!

The same worked also for me.

Related