How to most easily share your streamlit app locally?

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:

1 Like

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


Cool to hear that you made it work! Could you share in more detail, how you instruct pyinstaller to create the file and how your second .py file calls the streamlit command? Would like to copy your approach!

Great to hear that you make it work! I’m stuck in the samke problem. Could u share more details about how to config the Pyinstaller to make Streamlit work?
Cant wait to see your brilliant solution!

Hi guys,

So I have my main file with the code that I want to run (called which would look like something as follows:

import streamlit

def main():
    # do stuff here

if __name__ == "__main__":

and then another python file ( :

import subprocess
import other libraries that I use in‘streamlit run’)

And then I followed the tutorial which I linked to above and I believe called it on Let me know if that worked out for you! :slight_smile:

1 Like

Thanks for your response! Calling the Streamlit main with works!
I had gotten an error trying PyInstaller just now, but I successfully compiled other apps with PyInstaller before. Will try to get that running in the next days. Will report back!

1 Like

@chekos: quick question here: if you saved your app in a common folder in server (which had python virtual environment installed there), the user will not be able to upload any files directly from his local right?
He’ll have to copy files from his local -> shared folder and then choose those files during streamlit is running? Is that right?

@bjornvandijkman - I agree with @andreas_rc. I was able to successfully run .py with But when I converted this script to exe with pyinstaller - the exe creation was successful but when I tried running the .exe I got a fatal error, attached a screenshot. any gurus who can help here?!


I must admit, I also didn’t manage to get it running as an .exe /
The subprocess .py file works great, however packaging it with PyInstaller gave me various errors.
I would love to be able to share my app as one file, but PyInstaller seems to work only after tweaking the settings heavily. Or is there anything obvious we’re missing?

@andreas_rc do you have any leads about heavy tweaking steps to settings? I’m happy to try from my end and debug

Yes, that’s how it worked. Since we had a common shared folder we did not need to have the ability to upload your own files.

Unfortunately nothing specific. I had several error messages and was able to get past some of them with google but in the end stopped. I’ll check out Docker + AWS to share. If you have success with .exe would be interested to see!

Nice! I tested it and it does seem to work well. However, I get a 405 error when trying to use the st.file_uploader.

I also tried to select a path as follows:

# load data
path_input_data = st.sidebar.text_input("Provide the name to the subfolder in which your csv files are "
if path_input_data:
    excel_files = glob.glob(path_input_data + '/**/*.csv', recursive=True)

What I want to do is provide the complete path to the local folder in which data is stored. When creating a container I can only refer to the relative path inside of the container, which means that users cannot select their own data. Any suggestions on how to work around this? I’m probably missing something obvious here, as I am not too familiar with Docker images.

We also continue to keep in touch over email, but just to keep any other readers up to date, here is a summary of our discussion:

Thank you for getting in touch - I’m really pleased to hear you have enjoyed ContainDS Desktop!

I think the important piece of information you are missing is that the ‘workspace folder’ on your computer maps to the path ‘/app’ inside the Docker container.

So for example, on my Mac the container is running with a workspace of /Users/dan/streamlit-single and this can be accessed via /app in the container’s Streamlit code.

Here is my example folder on the Mac:

|- csvfiles
     |- test.csv
     |- testboxes.csv

My version of the Python code is at the end of this email, showing two methods of accessing the files - direct access through Python code, and then using st.file_uploader.

For the direct access method (not using st.file_uploader) it is important to understand that most of your computer’s hard drive is not accessible directly by the container. That is essential for security. So the csv files should ideally be in your workspace folder (as mine are above). You could always use a symlink if you really wanted to store them elsewhere on your hard drive.

Rather than expect the user to know that /app is the location for accessing the workspace from inside the container, in my example code I just expect them to type the immediate subfolder name of ‘csvfiles’ and then I prepend ‘/app/’ to that. In fact, if you just want to find all csv files in the workspace then you could just glob from the /app folder recursively anyway, so you don’t really need to specify the subfolder name.

For the file uploader version, I’m not too sure why you were seeing the 405 error. It seems to work for me using the streamlit-single Docker image, but I do see the 405 error using streamlit-launchpad images. I’ll take a look.

import streamlit as st
import glob
from os import path
import pandas as pd

st.markdown('# Based on subfolder path')

path_input_data = st.sidebar.text_input("Provide the name to the subfolder in which your csv files are "

st.write("Input path:", path_input_data)

docker_search_path = path.join('/app', path_input_data)

st.write("Search path:", docker_search_path)

if path_input_data:
    excel_files = glob.glob(docker_search_path + '/**/*.csv', recursive=True)

st.markdown('# Now try uploading')

uploaded_file = st.file_uploader("Choose a CSV file", type="csv")

if uploaded_file is not None:

     st.write('Uploaded file: ', uploaded_file)
     data = pd.read_csv(uploaded_file)

st.write('Streamlit version: ', st.version._get_installed_streamlit_version())
1 Like

I’ve updated streamlit-launchpad to work with the file_uploader now (version 0.0.6). To pick this up you might need to restart ContainDS Desktop and then create a new container from the latest ‘streamlit-launchpad’ in the Images tab.

@ bjornvandijkman
I have successfully created the .exe file by your procedure. But unable to run the .exe file, It’s throwing the below error.
‘Failed to execute script run_streamlit’
Please help!!

import streamlit as st
def main():
    """    # do stuff here. """
    st.markdown("Test this and that")

if __name__ == "__main__":

import subprocess as sp
import shlex"streamlit run"), shell=True)

I seem to successfully freeze with pyinstaller (pyinstaller -c) and run the exe. Will give it a try with my rather complicated streamlit project. I would guess it should work.

It also works with more complicated cases. The problem is, it only freeze

I am looking for a way to freeze and anything it makes use of. The reason: I want other people to be able to run my streamlit program without explicitly sharing the source code. Is this possible?

@mikee @bjornvandijkman
This is not the solution I was hoping for, as it only makes an .exe file of the calling script. Python and streamlit still needs to be present on the executer’s computer.
That’s why Srinath and andreas are not able to run the .exe
Am I missing something or is it just not possible to create a (single) executable with pyinstaller for streamlit apps?