Error C050 cant recognize language model en_core_web_trf while running python exe file created from auto-py-to-exe, but the code is running from python file.

I want the exe file to run as its running with the my_code.py file.

I tried -

import spacy
nlp = spacy.load('en_core_web_trf')

Then I tried -

import spacy 
from pathlib import Path 

model_path = 'path_to_en_core_web_trf' 
nlp = spacy.load(model_path)

Then I tried -

import spacy

directory model_path = 'path/to/your/virtualenv/lib/site-packages/en_core_web_trf' 
nlp = spacy.load(model_path) 

Created .spec file -

a = Analysis(['my_code.py'],
             pathex=['/path/to/script'],
             binaries=[],
             datas=[('/path/to/en_core_web_trf', 'en_core_web_trf')],
             ...)

Ran in cmd -

pyinstaller --onefile --add-data "en_core_web_trf;en_core_web_trf" my_code.py

I followed various other posts, but cannot resolve the issue.

I have been doing it in virtual env.

0

There are 0 best solutions below