I am pretty new to streamlit and coding in general so pls forgive me if this question is really basic but I can’t find an understandable tutorial that is not old and half of the links wont work or its for linux or smth and I dont understand how I use it on windows.
To my question: I want to deploy a little GUI for my Project that is accesible from different PCs, the problem is that I can’t use cloud services because I want the data to stay on my own PC and not upload it. What i found is Apache, I have my Streamlit App running localy and I can see the standart “It works” message from Apache, but I cant figure out how to deploy my app via apache. The guide for apache in this forum is very confusing so could someone maybe explain the basic steps to me?
Greetings and thanks in advance
Using Apache would still be a means of deploying your app on the internet. Are the PCs that you want your app to be accessible from using the same local network?
Actually they are @Caroline
You can build simple docker containers and deploy them even on a windows machine. I found this article useful (check the last paragraph ‘dockerizing…’) With this the apps run perfectly in the background (no terminal).
Does this work on windows too? Is he doing it on windows? It looks like smth linux doesnt it? @ksxx
look for docker desktop! It works on windows as well. I use it at work to share apps with my collegues
Ok I really dont understand the tutorial you posted, he posts lines of code that i dont know where and when to write.
I tried to follow this streamlit tutorial but i got stuck at “Build a Docker image” when I use
docker build -t streamlit .
in cmd. It tells me:
C:\Users\PPreussler\PythonProjekte\app>docker build -t streamlit .
[+] Building 0.0s (1/2)
=> [internal] load build definition from Dockerfile 0.0s
=> => transferring dockerfile: 2B 0.0s
failed to solve with frontend dockerfile.v0: failed to read dockerfile: open /var/lib/docker/tmp/buildkit-mount522145575/Dockerfile: no such file or directory
Sorry for the confusion. Looks like you don’t have the
Dockerfile in the same folder as your python files for the app. You have to create the dockerfile and it should contain all the lines the article explains in section 2), of course adapted to your app. For example, if your streamlit file is ‘myapp.py’ and it imports another .py file ‘mymodule.py’ from the same folder , then the Dockerfile could look like this:
COPY requirements.txt ./requirements.txt
RUN pip install -r requirements.txt
COPY myapp.py ./myapp.py
COPY mymodule.py ./mymodule.py
ENTRYPOINT ["streamlit", "run"]
Another file you need is
requirements.txt to import modules available via pip install into the container , in particular streamlit itself. For example if you need pandas and plotly,
requirements.txt looks like this;
docker build etc commands are executed on a normal windows terminal/shell (dos box) . Check that you are in the right folder where your app files are located.
After you did run the the container once form the commandline you can start and stop it also from the Docker App GUI without the need for the terminal window!
Btw, with the
docker run command you can also map your app to a different tcpip port, For example to map it to 8510 instead of the default 8501 execute (maypp1 is assumed to be the name of your container) :
docker run -p 8510:8501 myapp1:latest
If you want to run multiple streamlit containers choose a distinct port for each app (8510, 8511…)
hope this helps a little
So I followed your steps and now I have a rep containing this: Github
when I use CMD:
it tells me i need at least 1 argument. I am sorry if this is basic knowlege but as i said I’ve never done this before.
You have to name the container. Note the
. at the end of the command.
docker build -t myapp1:latest .
If this works successfully start the container:
docker run -p 8501:8501 myapp1:latest
So I just finished a tutorial about docker containers and how to build your own.
The problem was not that I didn’t name the container, the problem was that I created the dockerfile with windows rmt>new>.txt (sorry if thats not how you write it but i hope it’s understandable) and docker build didn’t recognise the dockerfile.
What solved it was to create the docker file in Visual Studio Code. now it isn’t a .txt file but just a “file” and now docker build works just fine. Just ran it the first time on my pc.
is it working now? i want to deploy my straemlit apps to, and confused how to do it.
if it’s already run, what ip address or domain name when you access it?
Hey there, it worked once last week but then I did something and it doesnt anymore, as soon as I got it figured out I wanted to write some sort of solution here anyways. ^^
Hey, I figured it out and updated the git with the solution Github
what do I do when I have 2 different python apps that use different versions of python? one is the newest and one has to run on python 2.7.1
as long as there is a docker container with 2.7 to download this should be easy (
FROM python:2.7 in dockerfile) but I dont think streamlit supports versions 2x.