streamlit icon indicating copy to clipboard operation
streamlit copied to clipboard

Server headless detection doesn't play nicely with ssh port forwarding

Open astrowonk opened this issue 1 year ago • 3 comments

Summary

The documentation says that server.headless mode is detected on linux when DISPLAY is but when I ssh in from windows either via git-bash ssh or via VS Code, the $DISPLAY variable echos empty but server.headless appears to be on (Localhost url is not displayed, and no attempt to open a browser.)

Related: headless behavior doesn't work well when developing with VS Code SSH remote. VS code will ssh Port forward and open a browser correctly if run with --server.headless false

Steps to reproduce

Run any streamlit app via ssh.

echo $DISPLAY
streamlit hello

Displayed url shows internal/external IP addresses. This implies server.headless has been set as true

streamlit hello --server.headless false

Expected behavior:

With DISPLAY not set, I expect server.headless to be false.

Actual behavior:

streamlit runs as if server.headless is true.

Is this a regression?

no

Debug info

  • Streamlit version: version 1.11.0
  • Python version: 3.9.12
  • conda
  • OS version: RHEL 7

Additional information

headless detection ostensibly exists to help with remote development but the most common way to remote develop (ssh and VS Code remote) doesn't get any benefits from it.


Community voting on feature requests enables the Streamlit team to understand which features are most important to our users.

If you'd like the Streamlit team to prioritize this feature request, please use the 👍 (thumbs up emoji) reaction in response to the initial post.

astrowonk avatar Jul 26 '22 15:07 astrowonk

Hi @astrowonk,

I think the behavior is as the documentation specifies. The output of streamlit config show is "Default: false unless (1) we are on a Linux box where DISPLAY is unset, or...", which matches up with the behavior observed (although I do agree that the description could probably be reworded for clarity).

vdonato avatar Jul 27 '22 00:07 vdonato

Hi @astrowonk,

I think the behavior is as the documentation specifies. The output of streamlit config show is "Default: false unless (1) we are on a Linux box where DISPLAY is unset, or...", which matches up with the behavior observed (although I do agree that the description could probably be reworded for clarity).

Ooof, ok I misread and thought it said set not unset. My apologies.

My broader point about this auto-headless behavior being unfriendly to the VS Code + ssh remote environment remains, however. I have to manually tell it to run in server.headless false to get the behavior that I think most Code users would want. (i.e. use port forwarding).

astrowonk avatar Jul 27 '22 00:07 astrowonk

My broader point about this auto-headless behavior being unfriendly to the VS Code + ssh remote environment remains, however. I have to manually tell it to run in server.headless false to get the behavior that I think most Code users would want. (i.e. use port forwarding).

Ah, okay. In that case, let me reopen this as an enhancement and change the title appropriately.

Note that I do think that this will end up quite far down in the priority list as it is still possible to have things play nicely with VS Code + ssh, it's just that having to specify the flag manually is inconvenient

vdonato avatar Jul 27 '22 00:07 vdonato

This was quite helpful for me & imho should be a default behaviour

pavluka6 avatar Feb 27 '24 00:02 pavluka6