Issues packaging spacy 3.0.6 and the en_core_web_sm.load()

420 views
Skip to first unread message

Jim McDonough

unread,
Jun 8, 2021, 10:43:35 AM6/8/21
to PyInstaller
My code works fine before packaging (nlp = en_core_web_sm.load()) but when I create the exe with pyinstaller I am getting the following error 

"catalogue.RegistryError: [E893] Could not find function 'spacy.Tok2Vec.v1' in function registry 'architectures'. If you're using a custom function, make sure the code is available. If the function is provided by a third-party package, e.g. spacy-transformers, make sure the package is installed in your environment."

I am not packaging it correctly.  My hook file is super nasty now and probably includes stuff not needed.  I was throwing anything at it from other solutions online:

import PyInstaller


datas = []
datas.extend(PyInstaller.utils.hooks.collect_data_files('spacy',include_py_files = True))
datas.extend(PyInstaller.utils.hooks.collect_data_files('spacy.lang', include_py_files = True))
datas.extend(PyInstaller.utils.hooks.collect_data_files('en_core_web_sm'))
datas.extend(PyInstaller.utils.hooks.collect_data_files('thinc',include_py_files = True))
datas.extend(PyInstaller.utils.hooks.collect_data_files('catalogue',include_py_files = True))
datas.extend(PyInstaller.utils.hooks.collect_data_files('srsly',include_py_files = True))
datas.extend(PyInstaller.utils.hooks.collect_data_files('spacy_legacy',include_py_files = True))

hiddenimports = [
    'catalogue.__init__',
    'spacy.attrs',
    'spacy.kb',
    'spacy.lexeme',
    #'spacy.matcher._schemas',
    'spacy.morphology',
    'spacy.parts_of_speech',
    #'spacy.syntax._beam_utils',
    #'spacy.syntax._parser_model',
    #'spacy.syntax.arc_eager',
    #'spacy.syntax.ner',
    #'spacy.syntax.nn_parser',
    #'spacy.syntax.stateclass',
    #'spacy.syntax.transition_system',
    'spacy.tokens._retokenize',
    'spacy.tokens.morphanalysis',
    'spacy.tokens.underscore',

    'blis',
    'blis.py',

    'cymem',
    'cymem.cymem',

    'murmurhash',

    'preshed.maps',

    'srsly.msgpack.util',

    'thinc.extra.search',
    'thinc.api',
    'thinc.config',
    #'thinc.registry',
    #'thinc.linalg',
    #'thinc.neural._aligned_alloc',
    #'thinc.neural._custom_kernels',
    'murmurhash.mrmr',
    'spacy.training.gold_io',
    'spacy.training.align',
    'spacy.vocab',
    'spacy.strings',
    'spacy.symbols',
    'spacy.tokenizer',
    'spacy.vectors',
    'spacy.vocab',
    'spacy.matcher.dependencymatcher',
    'spacy.matcher.phrasematcher',
    'spacy.matcher.matcher',
    'spacy.ml.parser_model',
    'spacy.pipeline.morphologizer',
    'spacy.pipeline.pipe',
    'spacy.pipeline.transition_parser',
    'spacy.pipeline._parser_internals.stateclass',
    'spacy.pipeline._parser_internals.transition_system',
    'spacy.pipeline._parser_internals._beam_utils',
    'spacy.pipeline._parser_internals.arc_eager',
    'spacy.pipeline._parser_internals.ner',
    'spacy.pipeline._parser_internals.state',
    #'spacy.pipeline._parser_internals.nonproj',
    #'spacy.pipeline.senter',
    #'spacy.pipeline.sentencizer',
    #'spacy.syntax._state',
    #'spacy.syntax.nonproj',
    'spacy.tokens.span',
    'spacy.tokens.token',
    'spacy.lang.en',
    "spacy.tokens._dict_proxies",
    'spacy.lang.norm_exceptions',
    'spacy.lang.lex_attrs',
    'spacy.lang.char_classes',
    'spacy.lang.punctuation',
    'spacy.lang.tokenizer_exceptions',
    'spacy.util',
    'spacy.__init__',
    'spacy.language'
   ]
Reply all
Reply to author
Forward
0 new messages