# How to most easily share your streamlit app locally?

Hi everyone,

This questions might not be entirely specific to Streamlit, but it is still an important one as I want to easily share my Streamlit apps to colleagues. Some of the requirements that I have:

1. I want the app to be run locally, as we are dealing with private data
2. Colleagues should not need to have a Github account
3. No Python code should need to be run to launch the app

How can I best do this, something like Pyinstaller?

1 Like

Hello @bjornvandijkman

I think a solution would be PyInstaller or PyOxidizer. I just tried to build a small Streamlit app with pyinstaller app.py but on running the app.exe I got :

pkg_resources.DistributionNotFound: The 'streamlit' distribution was not found and is required by the application
[11236] Failed to execute script app


but that was my first time using the library, maybe there are knobs to turn to configure the build process…

Other solutions I could think of :

• Seeing the requirements I guess the users are not tech-saavy, but is installing and running Docker containers on their machines a possibility ?
• I’m breaching the “locally” part but could you host your Streamlit app on a server and use the st.file_uploader so users can upload their private data and analyze it ? Each user should get their session and not access other people’s sessions.

In my institution we have a local server where all private data lives and the way I got around packaging the app was to write a .bat file that activates the base anaconda environment (which we all have in that server) and run the streamlit run app.py command.

I then created a shortcut icon for that .bat file so that my colleagues can just double-click it and poof! the app opens up a browser and it just works.

That’s another way of doing it ¯_(ツ)_/¯

Hope to share some steps，thanks

Hope to share some steps

This was my first time write a .bat file so it might be redundant but this is how it looks

set root=C:\ProgramData\Miniconda3\
call %root%\Scripts\activate.bat
call streamlit run "path\to\file\app.py"


after this i just created a shortcut icon to this file that i put in the shared project folder. You might not need to but it just makes it easier for non-technical colleagues

Hi @andfanilo and @chekos ,

Thank you for the suggestions and apologies for the delayed response.

I can get Pyinstaller to work with regular Python scripts. However, a missing argument in my executable file now is the call streamlit run app.py. According to @chekos I could include a .bat file to automate command line arguments, but I am not sure how I could create an .exe file in which such a .bat file is automatically executed.

My end goal is to have a single exe file that colleagues can execute without any restrictions.

Any help is appreciated!

Why not use subprocess.run(“streamlit run app.py”) in your wrapper python executable? That should build and deploy as an executable OK as long as you have Streamlit in your build requirements. If you need command line arguments to streamlit as well see the subprocess docs.

If you need to setup virtual environments and/or environment variables then you can use something like this (which has the same effect as the @chekos batch file) for the startup command:

cmd /c “conda activate appenv & setenv.bat & streamlit run apps/app.py”

Where setenv.bat sets the environment variables you need. All my environments run like this (I use ConsoleZ for DOS shells and each tab is started with an appropriate variant of the above cmd string).

For the 'live" server for my business users I use the same cmd layout in a batch file which is configured in Task Scheduler to startup with the machine.

This setup makes deploying and switching between environments very easy.

1 Like

I ended up using Pyinstaller with the subprocess.run command, which I ran from a different python file to not get stuck in an infinite loop haha. Thanks for the help guys!

1 Like

i have the same probleme.i create my application but i want to know how others uses it. for the moment I throw it from the cmd, however I close it from the cmd no one can use it

well for me an exe file was created using Pyinstaller that other users can click on. I suggest that you take a look at this video: https://www.youtube.com/watch?v=UZX5kH72Yx4

i check it

Some of these solutions will not cross-compile (i.e. if you have a Mac, Windows users won’t be able to run it), and are also susceptible to differences in the destination machine so they may not see exactly the same results.

A different approach, still involving only user-friendly software (i.e. GUIs) is using ContainDS which now supports Streamlit, so you can export a single ‘containds’ file to share with someone else who can import it directly to ContainDS running on their machine so the app runs exactly as intended.

It uses Docker underneath emulating an isolated Linux computer, allowing it to reproduce an identical environment.

I have written up a tutorial here: Share a Streamlit container as a File