- Are you running your app locally or is it deployed? Deployed
- If your app is deployed:
a. Is it deployed on Community Cloud or another hosting platform? Azure App Service
b. Share the link to the public deployed app. Not publicly accessible - Share the link to your app’s public GitHub repository (including a requirements file). No public repo
- Share the full text of the error message (not a screenshot). See below
- Share the Streamlit and Python versions. Streamlit 1.40 and Python 3.11
I’m creating an image with the following Dockerfile:
FROM python:3.11-slim
WORKDIR /app
COPY /app .
# Set environment variables to prevent Python from writing pyc files to disk
ENV PYTHONDONTWRITEBYTECODE 1
# Prevent Python from buffering stdout and stderr
ENV PYTHONUNBUFFERED 1
RUN apt-get update \
&& apt-get install --no-install-recommends -y \
# deps for building python deps
build-essential \
&& apt-get install --no-install-recommends -y libpq-dev
COPY requirements.txt ./requirements.txt
RUN pip install --no-cache-dir -r requirements.txt
EXPOSE 8501
WORKDIR /app
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=8501", , "--server.address=0.0.0.0"]
It looks like it should work when address is set to 0.0.0.0 and a port is set such that EXPOSE and –server.port are the same in the DockerFile and these match to the WEBSITES_PORT environment variable on the app service.
However, the service log shows the following traceback:
Traceback (most recent call last): File "/usr/local/bin/streamlit", line 8, in <module>
sys.exit(main())
^^^^^^
File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/click/core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/streamlit/web/cli.py", line 240, in main_run
_main_run(target, args, flag_options=kwargs)
File "/usr/local/lib/python3.11/site-packages/streamlit/web/cli.py", line 276, in _main_run
bootstrap.run(file, is_hello, args, flag_options)
File "/usr/local/lib/python3.11/site-packages/streamlit/web/bootstrap.py", line 329, in run
asyncio.run(run_server())
File "/usr/local/lib/python3.11/asyncio/runners.py", line 190, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/asyncio/base_events.py", line 654, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/streamlit/web/bootstrap.py", line 317, in run_server
await server.start()
File "/usr/local/lib/python3.11/site-packages/streamlit/web/server/server.py", line 275, in start
start_listening(app)
File "/usr/local/lib/python3.11/site-packages/streamlit/web/server/server.py", line 132, in start_listening
start_listening_tcp_socket(http_server)
File "/usr/local/lib/python3.11/site-packages/streamlit/web/server/server.py", line 199, in start_listening_tcp_socket
http_server.listen(port, address)
File "/usr/local/lib/python3.11/site-packages/tornado/tcpserver.py", line 183, in listen
sockets = bind_sockets(
^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/tornado/netutil.py", line 162, in bind_sockets
sock.bind(sockaddr)
OSError: [Errno 99] Cannot assign requested address
I’m at a loss as to what could be causing this to happen. I’ve never seen it with other Python apps we’ve hosted (including Dash apps).
I’d really appreciate some suggestions here.