I recently wrote a Python script that uses spaCy, which works as intended when run directly from Pycharm. I wanted to create an executable version of this to distribute to the rest of my team for ease of use, which I used pyinstaller for. I used the following spec file to do this:
# getExamplesv4.spec
# -*- mode: python ; coding: utf-8 -*-
block_cipher = None
a = Analysis(
['getExamplesv4.py'],
pathex=['.'],
binaries=[],
datas=[('C:/Users/pryce/AppData/Local/Programs/Python/Python311/Lib/site-packages/en_core_web_sm', 'spacy/data')],
hiddenimports=['spacy', 'en_core_web_sm'],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
)
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
exe = EXE(
pyz,
a.scripts,
[],
exclude_binaries=True,
name='Training Set Wizard v0.4.2',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
runtime_tmpdir=None,
console=True,
)
coll = COLLECT(
exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
upx_exclude=[],
name='Training Set Wizard v0.4.2',
)
Upon running the executable after completion, the following error loops in CMD indefinitely:
“Skipping pipeline package dependencies and setting --no-deps
. You
don’t seem to have the spaCy package itself installed (maybe because you’ve
built from source?), so installing the package dependencies would cause spaCy to
be downloaded, which probably isn’t what you want. If the pipeline package has
other dependencies, you’ll have to install them manually.”
I have verified that both spaCy and the pipeline I am using are installed correctly with up to date versions, I have verified that my paths in ‘datas’ for the spec file are correct, tried including the spaCy directory and pipeline directory both separately and together, included them as both imports and hidden imports, and tried reinstalling spaCy through pip.
Pryce Houck is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.