Dash app uses incorrect host name under Linux

I have dash app. It works perfectly fine under Windows 11 but not under Linux Mint. I start it with:
app.run(debug=False,port=‘8050’,host=‘0.0.0.0’)

But under Linux “host” seems to be ignored, because it prints:

Dash is running on http://x86_64-conda-linux-gnu:8050/

 * Serving Flask app 'My_App'
 * Debug mode: off
Name or service not known

Which is of course non-existent host and crashes app. When I print:
print(socket.gethostname()) in the same script just before app.run, it prints correct host name. It proves that there’s a conflict between conda and dash, and it cannot get correct list of hosts. How can I solve it? Everything in “host=” is ignored. I can force system to recognize “x86_64-conda-linux-gnu” as localhost by editing system host file but it is very dirty solution.

Edit:
it can be fixed by running HOST=0.0.0.0 (for example in bash) before running the python script but after mamba env is activated. But it is still workaround. The correct way will be to find out why host executed in run.app is ignored

Hi!

Can you try to run a small Flask app and see if the same problem happens?

from flask import Flask

app = Flask(__name__)

@app.route("/")
def home():
    return "Hello, World!"

if __name__ == "__main__":
    app.run(debug=True, host="0.0.0.0", port=8032)

Still, the source of the problem seems to be anaconda : Reddit - Dive into anything. I don’t know why it gets modified. TBH I never understood the need for Anaconda either (pip does the work already).

If print(socket.gethostname()) works, why not setting host=socket.gethostname()?

This way works. But when I use app = Dash instead of call flask directly, I can write anything in the host, so host=socket.gethostname() is not the way. I could probably even put host='banana', it basically doesn’t matter as it will be overwritten. At least now we know it id strictly dash bug, not flask itself.

I don’t use anaconda, it is heavy and poor optimized. However mamba (or any other miniforge-like managers) works well. The purpose is to use virtual envs. PiP cannot do that, it is simple package installer.