plotly / dash

Data Apps & Dashboards for Python. No JavaScript Required.
https://plotly.com/dash
MIT License
21.44k stars 2.07k forks source link

Temporary failure in name resolution #3003

Open summa-code opened 1 month ago

summa-code commented 1 month ago

This is occurring in latest Dash 2.18.1. Doing this app.run_server(host='0.0.0.0') .... did nothing

https://github.com/plotly/dash/issues/1480 Referring to old issue. It expects HOST environment variable to be set under conda. Passing this host parameter is not overriding.

gvwilson commented 1 month ago

@T4rk1n can you please have a look at this one and let me know what you think?

T4rk1n commented 1 month ago

I'm guessing this has to do with #2908 which fixed the load order but seems there is a conflict with conda setting the HOST environment on it's own.

T4rk1n commented 1 month ago

Not able to reproduce with latest miniconda3. Can we have more info on os, shell and anaconda/miniconda version?

wmn7 commented 1 month ago

Hello, I encountered the same issue, and I found that it's caused by the HOST setting in Conda. You can check it by running echo $HOST.

Below, I’m providing a temporary workaround where you can remove the HOST definition at the beginning of each script:

import os

if os.getenv('HOST'):
    del os.environ['HOST']

You can test it by running the following code:

import os
from dash import Dash, html

# Check and remove the HOST environment variable
if os.getenv('HOST'):
    del os.environ['HOST']

app = Dash()

app.layout = [html.Div(children='Hello World')] # Add Layout

if __name__ == '__main__':
    app.run_server(host='127.0.0.1', port='8050', debug=True)
misteroak commented 1 month ago

I suspect there's a bug where run_server() is ignoring the provided host? I set my env var to HOST=127.0.01 before running my script and it worked like a charm. Looked at dash.py, I see the following code block, which I suspect is overriding the provided host parameter to run_server (self.run) (along with port and proxy):

# Evaluate the env variables at runtime
host = os.getenv("HOST", host)
port = os.getenv("PORT", port) 
proxy = os.getenv("DASH_PROXY", proxy)