Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Streamlit started giving 404: Not Found and no longer wants to work. #244

Closed
Code4SAFrankie opened this issue Oct 2, 2019 · 31 comments · Fixed by #331
Closed

Streamlit started giving 404: Not Found and no longer wants to work. #244

Code4SAFrankie opened this issue Oct 2, 2019 · 31 comments · Fixed by #331
Labels
type:bug Something isn't working

Comments

@Code4SAFrankie
Copy link

Summary

Streamlit started giving 404: Not Found and no longer wants to work.

Steps to reproduce

Added the multiselect example to my code:

options = st.multiselect(
    'What are your favorite colors',
    ('Yellow', 'Red')
    ('Green', 'Yellow', 'Red', 'Blue'))
st.write('You selected:', options)

Expected behavior:

To get an app with a working multiselect

Actual behavior:

App gives 404: Not Found and nothing I do wants to make it work again.

Is this a regression?

yes

Debug info

Streamlit version: 0.47.2
Python version: 3.7.1
Using Conda? PipEnv? PyEnv? Pex? pip on WinPython
OS version: Windows 10 version 1903
Browser version: Firefox 69.0

Additional information

Tried changing the port, enabling debugging, killing the console and restarting. Not running jupyter-lab. Removing the multiselect code. Tried using http://localhost:8501/?a=1. Tried http://192.168.1.34:8501. Seems to be caching and always just returning the 404.

@Code4SAFrankie Code4SAFrankie added the type:bug Something isn't working label Oct 2, 2019
@Code4SAFrankie
Copy link
Author

.\streamlit hello now also 404's

@Code4SAFrankie
Copy link
Author

pip uninstall streamlit and pip install streamlit also did not help

@Hubes92
Copy link

Hubes92 commented Oct 2, 2019

I am having the same issue, running on Anaconda but all other Debug info is the same otherwise.

@treuille
Copy link
Contributor

treuille commented Oct 3, 2019

Thank you for this issue. @tvst is looking into this right now and we'll get back to you!

@treuille
Copy link
Contributor

treuille commented Oct 3, 2019

@Code4SAFrankie and @Hubes92 : Could you please try:

pip install streamlit==0.47.0

and see if that fixes the problem?

@treuille
Copy link
Contributor

treuille commented Oct 3, 2019

Also, we are still looking into this, but we believe this issue has to do with Windows, not your code snippet, @Code4SAFrankie.

After correcting a small bug in your code @Code4SAFrankie, I found that this worked for me (on MacOS):

import streamlit as st

options = st.multiselect(
    'What are your favorite colors',
    ('Green', 'Yellow', 'Red', 'Blue'),
    ('Yellow', 'Red'))
st.write('You selected:', options)

image

@Hubes92
Copy link

Hubes92 commented Oct 3, 2019

@Code4SAFrankie and @Hubes92 : Could you please try:

pip install streamlit==0.47.0

and see if that fixes the problem?

Install 0.47.0 still gives me the same error unfortunately.

@tvst
Copy link
Contributor

tvst commented Oct 3, 2019

Update: I was able to install Streamlit and run streamlit hello on a Windows VM without issues*.

*Well that's not 100% true... I ran into this #236 , but that's not Windows-specific and we have a fix coming out!

Then I re-read the issue and realized you're using something called WinPython — so let me try that tomorrow.

Clearly I'm not a Windows expert 👶 , apologies for the delay!

@Hubes92
Copy link

Hubes92 commented Oct 3, 2019

Update: I was able to install Streamlit and run streamlit hello on a Windows VM without issues*.

*Well that's not 100% true... I ran into this #236 , but that's not Windows-specific and we have a fix coming out!

Then I re-read the issue and realized you're using something called WinPython — so let me try that tomorrow.

Clearly I'm not a Windows expert 👶 , apologies for the delay!

@tvst Im having the same issue but Im not using WinPython, I run with anaconda. The config.py also hard codes the port in to 8051, I changed it in that script to see if that helps but it didnt. I also found that the address was hard coded to localHost and changed to various other valid localhost addresses in Server.py etc but that didnt help either. Hope it helps somewhat or might just be useless information.

@tvst
Copy link
Contributor

tvst commented Oct 3, 2019

You probably already checked this, but just to get the obvious things out of the way: can you make sure Windows Firewall is not blocking Streamlit?

I noticed that when I first ran a Streamlit app on Windows I had to click through a dialog to allow it to use port 8501. I don't know if there's some situation that would cause the firewall to revoke that permission behind the scenes...

@Hubes92
Copy link

Hubes92 commented Oct 3, 2019

Yeah @tvst double checked that and changed the port as well in case that was the cause.

@HarshBathia
Copy link

Facing the same issue

@Zir01
Copy link

Zir01 commented Oct 3, 2019

Same here. Win10 / Python 3.7.1

$ pip install streamlit
$ streamlit hello

I also tried the version 0.47.0 but same 404: Not Found
Firewall not blocking port 8501

@mzeidhassan
Copy link

mzeidhassan commented Oct 4, 2019

Windows 10 / Python 3.6.7

Running "streamlit hello", gives me 404 error.
404: Not Found

@Code4SAFrankie
Copy link
Author

Note that you can't run jupyter-lab and streamlit at the same time, since they both by default use the same port; but even getting the 404 without running jupyter-lab. Streamlit did initially work, but then stopped working and instead giving 404.

@ismailuddin
Copy link

I've been able to get it to work while running JupyterLab by simply navigating to http://localhost:8501/index.html and then the page loads, otherwise its a 404.

@Code4SAFrankie
Copy link
Author

Wow! Going to http://localhost:8501/index.html does not give me the 404 error, but instead correctly loads!!! Thanks!

@mzeidhassan
Copy link

@ismailuddin Thanks a million! It does work on http://localhost:8501/index.html

@tvst
Copy link
Contributor

tvst commented Oct 4, 2019

I've been able to get it to work while running JupyterLab by simply navigating to http://localhost:8501/index.html and then the page loads

Awesome, @ismailuddin !! Thanks for the work-around.

I'm still having problems reproducing the issue, though. So I have some more questions:

  1. Did a previous version of Streamlit ever work? If so, can you downgrade and confirm? (When doing this, use streamlit version to double-check which version you're on)
  2. Can you send me a HAR file for what happens when you go to localhost:8501/ and when you go to localhost:8501/index.html?

Here's a page talking about how to grab a HAR file in different browsers: https://community.box.com/t5/Managing-Content-Troubleshooting/How-to-Generate-Network-Captures-for-Troubleshooting/ta-p/366


Note that you can't run jupyter-lab and streamlit at the same time, since they both by default use the same port;

Weird. On my machine, JupyterLab uses 8888 while Streamlit uses 8501. Are you saying they're both on 8501 on your machine?

Also, since version 0.47.0 Streamlit tries to find an open port when 8501 is taken. So even if JupyterLab is on that port Streamlit should run fine.

Edit: I just realized the port-finder code isn't working on Python 2. We have a fix and will have it out with the next release. This is fixed since 0.47.4

@myounus96
Copy link

Thank you @ismailuddin

@ismailuddin
Copy link

Yup on my machine Jupyter Lab is using port 8888 as well so it shouldn't actually be interfering. Tbh, I didn't actually try without JLab since it's practically always running on my laptop. Unfortunately I don't have access to my Windows machine for a few days so won't be able to try any of that out just yet.

@Code4SAFrankie
Copy link
Author

Code4SAFrankie commented Oct 7, 2019

Sorry Jupyter Lab is using port 8888 on my machine.

@tvst
Copy link
Contributor

tvst commented Oct 8, 2019

Thanks, that makes sense! So I'm assuming the JupyterLab thing is a red herring at this point.

My best guess is that this would be fixed if we modified this function call in streamlit/server/Server.py to this:

            routes.extend(
                [
                    (r"/(.*)", StaticFileHandler, {
                        "path": "%s/" % static_path,
                        "default_filename": "index.html",
                    }),
                ]
            )

But I can't repro the issue, so I can't verify that this fixes it. (Although we should probably do this anyway since it's cleaner than the current code!)

That said, if any enterprising soul would like verify that the above solves your problem, that would be amazing 😃

@Code4SAFrankie
Copy link
Author

That change fixes the issue for me.

@tvst
Copy link
Contributor

tvst commented Oct 8, 2019

Awesome! Sending out a pull request right now.

tvst added a commit to tvst/streamlit that referenced this issue Oct 8, 2019
@tvst tvst closed this as completed in #331 Oct 9, 2019
tvst added a commit that referenced this issue Oct 9, 2019
* Improve how we serve index.html to fix #244

* Make util.open_browser() not add 'index.html' suffix on Windows.

* Improve DeckGL docs.

* Fix typo in comment.
@BENBOUZIANE
Copy link

work for me perfectly

pip install streamlit==0.47.0

@treuille
Copy link
Contributor

@BENBOUZIANE : Could you please let us know if you're still seeing this issue in 0.50.2, the latest version of Streamlit? If so, we would greatly appreciate if you opened a new bug describing your experience.

Thank you for using Streamlit!

@BENBOUZIANE
Copy link

@treuille : Yes the problem still exists in version 0.50.2 which is why I installed version 0.47.0.

@kurt-rhee
Copy link

@treuille : I am able to see localhost in streamlit 0.51.0 but no cannot find the page on the network.

@treuille
Copy link
Contributor

treuille commented Jan 1, 2020

@kurt-rhee : I'm sorry you're having that problem. Could you please open a bug report and fill in the full form so that we can reproduce this issue? Thanks, and happy New Year! 🎆

@kurt-rhee
Copy link

@treuille thanks for the mention, I was able to figure the problem out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.