5

I am building an application in streamlit that, for several reasons, cannot be hosted on a server. The most blocking reason is that it should also work without internet access. Therefore, I would like to turn my application in some sort of executable that users can run on their own laptop and the app is hosted on localhost.

I have the following code:

import streamlit.cli as stcli
import sys

def streamlit_run():
    sys.argv = ["streamlit", "run", "main.py", "--global.developmentMode=false"]
    sys.exit(stcli.main())


if __name__ == '__main__':
    streamlit_run()

main.py is for now a simple hello-world application. If I run

python wrapper.py

in my command line, the app runs on localhost. I turn it into an executable using pyinstaller, running

pyinstaller --onefile script.py

and an executable file is created. However, if I run this executable, nothing happens: I only see a black screen for a split second and that's it. Any help on how I can resolve this issue? Any other solution to let cleints use the application without hosting it on a server would be appreciated as well!

Versions: python==3.9 streamlit==0.73.0 pyinstaller==4.1

Larsq
  • 315
  • 2
  • 12
  • Have a look at https://discuss.streamlit.io/t/using-pyinstaller-or-similar-to-create-an-executable/902/13?u=lepy – steller Aug 25 '21 at 17:04

0 Answers0