Streamlit Deployment as an Executable File (.exe) For Windows MacOS And Android

wow… amazing its work even in local host

C:\Users\hp>nativefier --name one_2 http://localhost:8501 --platform windows

:star_struck: :star_struck: :star_struck:

1 Like

Hi there, how did you get it to work with localhost? Did you have to put any code in the main app to get it working? I just get a white screen like the user above mentioned.

Hi, I realized that my app only work in my machine, and the ‘app.exe’ need the exact ‘file.py’ that you use to run your streamlit app, so if you delete or move the file.py to other folder, or computer, the app.exe will not work…

As reported above, the best way is to deploy and then create the executable.

Thanks for the prompt reply!

Yeah I tried it exactly as you mentioned locally, seems it requires the py file. Will try to deploy then create the exe :slight_smile:

Thanks again!

Hi @Edmilson_Philimone, @beep92,

The streamlit application acts as a frontend and backend, where the backend contains all the logic you put into the app. The Nativefier application grabs the generated frontend code (html, js, css) and puts it into Electron app. So it still depends on the backend to be running for all input and output to be processed. So the streamlit app will indeed need to be deployed somewhere in order for the nativefier application to work correctly.

My explanation might be a bit off here and there, but this is my understanding of it :slight_smile:.

1 Like

Hello @maarten-betman,

You’re spot on; I researched the Nativefier application a bit right after, and it just extracts the frontend as an exe as you mentioned, not really extracting the full application - so I can’t use it anyways (not really a solution for offline use).

I’ll have to continue my research on making it fully usable offline as a deployed application :slight_smile: .

Appreciate your response!

2 Likes

Hi @beep92,

Good to know :slight_smile:

I dockerized a couple of streamlit application for offline usage (I work quite remote sometimes). Pulling the image will of course require internet, but there after should be no problem. If you don’t want to put the image on dockerhub there’s some pretty affordable private repo options or you can package the image as a tarball (I believe). For the less tech-savy users you can make a small batch script they can run once to get the container up for the first time, there after they can use the Docker desktop GUI to restart containers which is quite user friendly.

You’re awesome, thank you @maarten-betman.

I will give this a try tonight, that sounds interesting - it could work for me. I just saw that docker hub costs a small monthly fee to host private repos. I will test with some dummy code and if it works, it might be the best option for now.
My users are not tech-savy at all, so the batch file is probably the best way to go to launch the app. I’ll test this out as I’m not too familiar with docker yet. I’ll report back my results :slight_smile:

1 Like

Thanks its worked only with the final command i used
nativefier URL, however takes time to connect to streamlit server and every operation take more time

Hi , I tried to do this with multiple streamlit apps but every time ,when i click the .exe file I get a white screen :

Unbelievable. I can´t believe it worked. Thanks

Are you running the streamlit server when opening the executable?

How did you deploy on MAC :smiley: ?

probably

on windows OS?