Run bash build-linux.sh
to reproduce on Linux (assumes python3
is installed somewhere in $PATH
), or build-win.bat
to reproduce on Windows (assumes Python 3.7.6 is installed at C:/Python37/
)
It will fail with something like:
$ ./dist/linux/Foo/foo_r
Traceback (most recent call last):
File "run.py", line 2, in <module>
lm = spacy.load('en_core_web_sm')
File "spacy/__init__.py", line 30, in load
File "spacy/util.py", line 169, in load_model
OSError: [E050] Can't find model 'en_core_web_sm'. It doesn't seem to be a shortcut link, a Python package or a valid path to a data directory.
[1431] Failed to execute script run
Now edit spacy/util.py
to hardcode the assumption that en_core_web_sm
is an importable package, e.g. on Linux:
sed -Ei 's/if is_package\(name\):/if is_package\(name\) or name == "en_core_web_sm":/' venv/lib/python3.6/site-packages/spacy/util.py
(or corresponding manual edit)
and rebuild with pyinstaller --clean -y --dist ./dist/linux --workpath /tmp --debug all foo.spec
and it will run fine:
$ ./dist/linux/Foo/foo_r
Hi interjection