localhost:8501 (Streamlit): not working, port and fixes
Port 8501 is Streamlit’s default. How to open your app, change the port and fix errors.
Open this address: http://localhost:8501This opens on your own computer. It only works if the program is running.
localhost:8501 is the default address of a Streamlit app. It works while the streamlit command keeps running in your terminal.
What runs on localhost:8501
- Streamlit apps started with
streamlit run
Commands to start and test port 8501
streamlit run app.pystreamlit run app.py --server.port 8502streamlit run app.py --server.address 0.0.0.0Find what is using port 8501
Run these in a terminal on your computer. Nothing is sent to this site.
If localhost:8501 will not open
- Streamlit opens at 127.0.0.1 but not at localhost
server.addressis unset by default. If you set it, Streamlit’s config reference says the server is reachable only at that address, not at aliases such as localhost. Use--server.address 0.0.0.0for every address, or leave it unset.- The browser does not open by itself
server.headlessis false by default, except on Linux with no display. When it is true Streamlit does not open a browser, so open the printed URL yourself.browser.serverAddress(default localhost) is the address Streamlit prints and uses for CORS and XSRF checks.- The app is stuck on “Please wait” behind a proxy
- Streamlit talks to the browser over WebSockets. A reverse proxy such as Apache or nginx must pass WebSocket upgrade requests through, or the page never finishes loading.
- Changes are not picked up
server.fileWatcherTypeaccepts auto, watchdog, poll and none. Try poll on network drives or WSL.streamlit config showprints every setting in use.- Upload or form errors behind a proxy
server.enableCORSandserver.enableXsrfProtectionare both true by default. Behind a proxy with a different public address, setbrowser.serverAddressto that address before turning protections off.- Port 8501 is already in use
- An older Streamlit app is still running. Stop it, or start the new one with
--server.port 8502. - streamlit: command not found
- Install it with
pip install streamlitand activate the right Python environment. - Blank page
- Read the terminal for Python errors. Streamlit shows them there and in the page.
- Cannot open it from your phone
- Use
--server.address 0.0.0.0and your computer’s IP address. See how to open localhost from your phone.
Other ports like 8501
| Port | Usually used by |
|---|---|
| localhost:3000 | React, Next.js, Express |
| localhost:5173 | Vite dev server |
| localhost:4200 | Angular dev server |
| localhost:5000 | Flask |
| localhost:8000 | Django, PHP, Python |
| localhost:8080 | Tomcat, Spring Boot, Docker |
| localhost:8888 | Jupyter Notebook |
Questions about localhost:8501
- What is port 8501?
- The default port of Streamlit apps.
- How do I run two Streamlit apps?
- Start the second with a different port, such as --server.port 8502.