Open RajiRai opened 5 years ago
you can create a hook file with name hook-gensim.py under venv/lib/python3.7/site-packages/PyInstaller/hooks folder ( assuming venv is you virtual environment folder name & python 3.7 as as your python version). the following is the hook file i have used for my application. this is not the best solution but its a working solution for me.
from PyInstaller.utils.hooks import collect_submodules, collect_data_files
# This collects all dynamically imported gensim modules and data files.
hiddenimports = (collect_submodules('gensim') + collect_submodules('gensim.models')+
collect_submodules('gensim.corpora')+ collect_submodules('gensim.sklearn_api')+
collect_submodules('gensim.summarization') + collect_submodules('gensim.parsing')+
collect_submodules('gensim.topic_coherence')+collect_submodules('gensim.scripts')+collect_submodules('gensim.viz')+
collect_submodules('gensim.similarities')+collect_submodules('gensim.test')
)
datas = (collect_data_files('gensim') + collect_data_files('gensim.models')+
collect_data_files('gensim.corpora')+ collect_data_files('gensim.sklearn_api')+
collect_data_files('gensim.summarization') + collect_data_files('gensim.parsing')+
collect_data_files('gensim.topic_coherence')+collect_data_files('gensim.scripts')+collect_data_files('gensim.viz')+
collect_data_files('gensim.similarities')+collect_data_files('gensim.test')
)
Thanks for the hook file. I will look into it. -Raji
On Thu, Jun 13, 2019 at 5:04 PM balamurugan notifications@github.com wrote:
you can create a hook file with name hook-gensim.py under venv/lib/python3.7/site-packages/PyInstaller/hooks folder ( assuming venv is you virtual environment folder name & python 3.7 as as your python version). the following is the hook file i have used for my application. this is not the best solution but its a working solution for me.
from PyInstaller.utils.hooks import collect_submodules, collect_data_files This collects all dynamically imported gensim modules and data files.
hiddenimports = (collect_submodules('gensim') + collect_submodules('gensim.models')+ collect_submodules('gensim.corpora')+ collect_submodules('gensim.sklearn_api')+ collect_submodules('gensim.summarization') + collect_submodules('gensim.parsing')+
collect_submodules('gensim.topic_coherence')+collect_submodules('gensim.scripts')+collect_submodules('gensim.viz')+ collect_submodules('gensim.similarities')+collect_submodules('gensim.test')
) datas = (collect_data_files('gensim') + collect_data_files('gensim.models')+ collect_data_files('gensim.corpora')+ collect_data_files('gensim.sklearn_api')+ collect_data_files('gensim.summarization') + collect_data_files('gensim.parsing')+
collect_data_files('gensim.topic_coherence')+collect_data_files('gensim.scripts')+collect_data_files('gensim.viz')+ collect_data_files('gensim.similarities')+collect_data_files('gensim.test')
)
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/pyinstaller/pyinstaller/issues/4247?email_source=notifications&email_token=AF2LNSKEF565EZJBDPJHUQ3P2IWEDA5CNFSM4HPMR7TKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXTM4AI#issuecomment-501665281, or mute the thread https://github.com/notifications/unsubscribe-auth/AF2LNSPW3T3EXP6BED5T5LLP2IWEDANCNFSM4HPMR7TA .
Hi I have a python script to summarize text using Python's gensim package. I wanted to create a exe for this script. When I compiled this script using Pyinstaller, the exe was created but it is not opening and throwing fatal error. I commented the gensim import and compiled, the exe file opened successfully. So due to lack of hook for gensim, I presume the exe is throwing error.
Below is my code:
from gensim.summarization import summarize from tkinter import import tkinter from tkinter import messagebox top = Tk()
def process(): sentence=Entry.get(E1) ans=summarize(sentence) Entry.insert(E4,0,ans) print(ans)
top.title("Text Summarizer") L1 = Label(top, text="Text Summarizer",).grid(row=0,column=1) L2 = Label(top, text="Enter text to summerize",).grid(row=1,column=0) L3 = Label(top, text="Answer",).grid(row=4,column=0) E1 = Entry(top, bd=5) E1.grid(row=1, column=1) E4 = Entry(top, bd =5) E4.grid(row=4,column=1) B=Button(top, text ="Submit",command = process).grid(row=5,column=1,)
top.mainloop()*
I searched for solution but found none hence requesting help on this.
Thanks Raji