Hello everyone!
I have a Streamlit application that runs normally using python venv.
When I put the following Dockerfile to use distroless:
FROM python:3.12 AS build-env
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt --target /app
COPY dashboard/ .FROM gcr.io/distroless/python3-debian12
WORKDIR /app
COPY --from=build-env /app /app
ENV PYTHONPATH=/app
EXPOSE 8501CMD [“streamlit”, “run”, “dashboard/main.py”, “–server.address 0.0.0.0”]
The build completes fine. However, when running the containerized application, I receive the following error:
docker run --rm --name panel-pls -p 8501:8501 sjpa-pls:v1.0.1
Traceback (most recent call last):
File “”, line 198, in _run_module_as_main
File “”, line 88, in _run_code
File “/app/streamlit/main.py”, line 15, in
from streamlit.web.cli import main
File “/app/streamlit/init.py”, line 61, in
from streamlit import config as _config
File “/app/streamlit/config.py”, line 28, in
from streamlit import config_util, development, env_util, file_util, util
File “/app/streamlit/config_util.py”, line 19, in
from streamlit import cli_util
File “/app/streamlit/cli_util.py”, line 22, in
from streamlit import env_util, errors
File “/app/streamlit/env_util.py”, line 18, in
import platform
File “/app/streamlit/platform.py”, line 20, in
from streamlit.runtime.scriptrunner_utils.script_run_context import get_script_run_ctx
File “/app/streamlit/runtime/init.py”, line 17, in
from streamlit.runtime.runtime import Runtime, RuntimeConfig, RuntimeState
File “/app/streamlit/runtime/runtime.py”, line 25, in
from streamlit.components.lib.local_component_registry import LocalComponentRegistry
File “/app/streamlit/components/lib/local_component_registry.py”, line 29, in
_LOGGER: Final = get_logger(name)
^^^^^^^^^^^^^^^^^^^^
File “/app/streamlit/logger.py”, line 126, in get_logger
setup_formatter(logger)
File “/app/streamlit/logger.py”, line 71, in setup_formatter
if config._config_options:
^^^^^^^^^^^^^^^^^^^^^^
AttributeError: partially initialized module ‘streamlit.config’ has no attribute ‘_config_options’ (most likely due to a circular import)
Does anyone know how to solve it?