I am trying to compile my application on the poetry environment where I am building the package.
Here is the spec file. This same spec file compiles fine via GitHub actions but fails on my poetry environment.
# -*- mode: python ; coding: utf-8 -*-
from PyInstaller.utils.hooks import copy_metadata
import sys
sys.setrecursionlimit(5000)
datas = []
datas += copy_metadata('pkg', recursive = True)
a = Analysis(
['app.py'],
pathex=[],
binaries=[],
datas=[],
hiddenimports=[],
hookspath=[],
hooksconfig={},
runtime_hooks=[],
excludes=[],
noarchive=False,
optimize=0,
)
pyz = PYZ(a.pure)
exe = EXE(
pyz,
a.scripts,
a.binaries,
a.datas,
[],
name='pkg',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True,
disable_windowed_traceback=False,
argv_emulation=False,
target_arch=None,
codesign_identity=None,
entitlements_file=None,
)
When I run the command pyinstaller --clean app.spec
, it gives me this warning which makes me think that pyinstaller is not able to fine some dependencies in the virtual environment.
219 WARNING: Assuming this is not an Anaconda environment or an additional venv/pipenv/...
environment manager is being used on top, because the conda-meta folder
C:UsersXXXXAppDataLocalpypoetryCachevirtualenvsvenvconda-meta does not exist.
Would greatly appreciate any suggestions to fix this. Below is the ImportError
I get in the window of the compiled executable.
Traceback (most recent call last):
File "PyInstallerhooksrthookspyi_rth_pkgrespy", line 158, in <module>
File "PyInstaller hooks rthookspyi_rth_pkgres.py" line 36, in _pyi_rthook
File "PyInstallerloader pyimode2_importers .py", line 419, in exec _module
File "pkg _resources__init__py", line 63, in <module>
File "PyInstaller loader pyimod02_importers.py", line 419, in exec _module
File "plistlib.py", line 70, in <module>
File "PyInstallerloader pyimode2_importers py", line 419, in exec_ module
File "xmI parsers expat.py" line 4, in <module>
[ImportError: DLL load failed while importing pyexpat: The specified module could not be found.
[22988] Failed to execute script "pyi rth_pkgres" due to unhandled exception!
I included setuptools
in my poetry dependencies as per a stack overflow suggestion, but didn’t help.