How to make streamlit run on codespaces?

poetry run streamlit hello runs on local computer, but on Github Codespaces the page hangs at “Please wait…”. The port is forwarded to external URL.

Any clues why page is not rendering?

1 Like

Very early discussion on the same topic: Development on Github Codespace

1 Like

Been struggling with this for a few hours now :smiling_face_with_tear:

Streamlit opens but doesn’t load any apps including streamlit hello

@robmarkcole are you still able to run streamlit in codespaces?

Hi, I had the same issue. I have solved this problem using this solution.

streamlit hello --server.enableCORS false --server.enableXsrfProtection false


Hi @fhtsibuya, welcome to the community and thanks for your solution!! :wave: :partying_face:

I’ve created a repo that includes the command line config options in a config.toml, to avoid typing them each time you run an app:


Nice, thanks @fhtsibuya! :smiley:

@snehankekre good idea having it in the config, didn’t realize that. Do you know if it’s possible to have multiple terminal commands [in devcontainer] on launch?

I want to have both pip install reqs and streamlit run with the server commands instead of having it be in config.toml. This is because I have deployed an app via github and want --server.enableCORS false --server.enableXsrfProtection false only when developing in codespaces to get it to display and not when deployed

@batman It is possible: devcontainer.json reference

Depending on your use-case, you can either use postCreateCommand or postStartCommand to run multiple commands, if each command is separated by &&. For example

"postStartCommand": "apt-get install -y curl && pip install -r requirements.txt",

Or if you have a ton of commands to run, store them in a .sh script, copy the script to the container, and run the bash script via the postStartCommand.

1 Like

Brilliant, thank you! :smiley:

And btw I just tried running your repo in a code space and it gets stuck on the please wait screen again :sweat_smile: I guess something may have changed

I just noticed that too :sweat_smile: The behavior doesn’t appear to be deterministic / reliable. If you wait for a few minutes after the container starts to run streamlit hello or streamlit run, it works as expected. If you run the app immediately, it seems to get stuck on the please wait screen.

I also observed that refreshing the page or restarting the app can sometimes get rid of the please wait screen.

1 Like

Oh wow that’s very weird :joy: thank you for that tip, I’ve really been struggling to get this working lol

And refreshing hasn’t worked for me but maybe it’s because I always run it immediately. Will try waiting a little first, hopefully it works! Thanks again :smile:

@snehankekre were you able to use codespaces again? I haven’t been able to get it to work (at all lol)

I tried --server.enableWebsocketCompression=false as well

@batman I did just get it running again by launching codespaces from my repo:

However, it isn’t reliable. I had to wait a full minute after streamlit hello for the Please Wait ... message to go away and for the app to work. :confused:

1 Like

Thank you for checking again @snehankekre! I wonder whether it’s the server region (Europe) that’s causing a problem for me

Also, I don’t know whether it’s related but recently my app deployed via heroku stays on the “please wait…” screen for so much longer than it’s used to. Do you think it could be a similar issue? Running 1.10.0

Update: just tried launching the heroku app, it took about 6-7 minutes

I haven’t deployed to Heroku yet, so I have no comments :sweat_smile: I’ll defer to others in the community.

1 Like