File size: 1,858 Bytes
a9c2120 99d6fba 2bcd818 a9c2120 2bcd818 a9c2120 2bcd818 99d6fba 2bcd818 4ee3470 99d6fba 2bcd818 a9c2120 2bcd818 a9c2120 4ee3470 739b386 a9c2120 99d6fba a9c2120 99d6fba a9c2120 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
1. Create minimal environment to run the app in conda. E.g. 'conda create --name new_env' 2. Activate the environment 'conda activate new_env' 3. cd to this folder. Install packages from requirements.txt using 'pip install -r requirements.txt' NOTE: for ensuring that spaCy models are loaded into the program correctly in requirements.txt, follow this guide: https://spacy.io/usage/models#models-download 6. If necessary, create hook- files to tell pyinstaller to include specific packages in the exe build. Examples are provided for gradio and en_core_web_sm (a spaCy model). Put these in the build_deps\ subfolder 7. pip install pyinstaller 8. In command line, cd to the folder that contains app.py. 9.Run the following, assuming you want to make one single .exe file (This helped me: https://github.com/pyinstaller/pyinstaller/issues/8108): a) In command line: pyi-makespec --additional-hooks-dir="build_deps\\" --collect-data=gradio_client --collect-data=gradio --hidden-import pyarrow.vendored.version --onefile --name DataSearchApp_0.3 app.py b) Open the created spec file in Notepad. Add the following to the end of the Analysis section then save: a = Analysis( ... module_collection_mode={ 'gradio': 'py', # Collect gradio package as source .py files } ) c) Back in command line, run this: pyinstaller --clean --noconfirm DataSearchApp_0.3.spec 9. A 'dist' folder will be created with the executable inside along with all dependencies('dist\data_text_search'). 10. In 'dist\data_text_search' try double clicking on the .exe file. After a short delay, the command prompt should inform you about the IP address of the app that is now running. Copy the IP address. **Do not close this window!** 11. In an Internet browser, navigate to the indicated IP address. The app should now be running in your browser window. |