[BUG] Flask 2.2.0 unbound_message error.
See original GitHub issueDescribe your context Environment currently running in Docker, with the following Dockerfiles:
Our ubuntu:latest dockerfile:
FROM ubuntu:20.04
ENV DEBIAN_FRONTEND=“noninteractive”
LC_ALL=“en_US.UTF-8”
LANG=“en_US.UTF-8”
LANGUAGE=“en_US.UTF-8”
RUN apt-get update &&
apt-get upgrade -y &&
apt-get install -y ca-certificates tzdata locales &&
update-ca-certificates -f &&
rm /etc/timezone &&
rm /etc/localtime &&
echo “Europe/Berlin” | tee /etc/timezone &&
ln -s /usr/share/zoneinfo/Europe/Berlin /etc/localtime &&
dpkg-reconfigure --frontend noninteractive tzdata &&
locale-gen en_US.UTF-8 &&
echo “LC_ALL=en_US.UTF8” > /etc/default/locale &&
echo “LANG=en_US.UTF8” >> /etc/default/locale &&
echo “LC_CTYPE=en_US.UTF8” >> /etc/default/locale &&
echo “LC_COLLATE=en_US.UTF8” >> /etc/default/locale &&
chmod 0755 /etc/default/locale
Our python:latest dockerfile:
FROM **/base-images/ubuntu:latest
ADD pip.conf /etc/pip.conf
ENV REQUESTS_CA_BUNDLE=“/etc/ssl/certs/ca-certificates.crt”
PIP_DEFAULT_TIMEOUT=120
RUN apt-get update &&
apt-get install -y build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libreadline-dev libffi-dev libsqlite3-dev wget libbz2-dev curl &&
mkdir /tempdir &&
cd /tempdir &&
curl https://www.python.org/ftp/python/3.10.2/Python-3.10.2.tgz -o python.tgz &&
tar -xvzf python.tgz &&
cd Python-3.10.2 &&
./configure --enable-optimizations &&
make &&
make install &&
cd &&
rm -rf /tempdir &&
python3 -m pip install --upgrade pip &&
pip3 install requests &&
apt-get remove -y curl wget
USER app
WORKDIR /app
ENV PATH=“${PATH}:/app/.local/bin/”
CMD [“/usr/bin/python3”]
Our dash:latest dockerfile:
FROM **/base-images/python:latest USER root RUN pip3 install dash dash-renderer dash-html-components dash-core-components plotly gunicorn Flask EXPOSE 5000 USER app COPY *.py /app/ CMD [“gunicorn”, “–workers”, “1”, “–bind”, “0.0.0.0:5000”, “–timeout”, “100000”, “–max-requests”, “20”, “–access-logfile”, “-”, “–error-logfile”, “-”, “–capture-output”, “application:server”]
Our docker file:
FROM **/base-images/dash:latest
EXPOSE 5000
CMD [“gunicorn”, “-w”, “1”, “-b”, “0.0.0.0:5000”, “-t”, “0”, “–max-requests”, “0”, “–access-logfile”, “-”, “–error-logfile”, “-”, “–capture-output”, “index:server”]
USER root
COPY requirements.txt /tmp/
RUN pip3 install -r /tmp/requirements.txt &&
rm /tmp/requirements.txt
USER app
COPY . /app
- replace the result of
pip list | grep dashbelow
dash 2.0.0
dash-bootstrap-components 0.11.4rc3
dash-core-components 2.0.0
dash-html-components 2.0.0
dash-table 5.0.0
Describe the bug
I am not able to start my app, I get the following error:
[2022-08-08 11:24:34 +0200] [1] [INFO] Starting gunicorn 20.0.4 [2022-08-08 11:24:34 +0200] [1] [INFO] Listening at: http://0.0.0.0:5000 (1) [2022-08-08 11:24:34 +0200] [1] [INFO] Using worker: sync [2022-08-08 11:24:34 +0200] [8] [INFO] Booting worker with pid: 8 [2022-08-08 11:24:34 +0200] [9] [INFO] Booting worker with pid: 9 [2022-08-08 11:24:34 +0200] [10] [INFO] Booting worker with pid: 10 [2022-08-08 11:24:34 +0200] [8] [ERROR] Exception in worker process Traceback (most recent call last): File “/usr/local/lib/python3.8/dist-packages/gunicorn/arbiter.py”, line 583, in spawn_worker worker.init_process() File “/usr/local/lib/python3.8/dist-packages/gunicorn/workers/base.py”, line 119, in init_process self.load_wsgi() File “/usr/local/lib/python3.8/dist-packages/gunicorn/workers/base.py”, line 144, in load_wsgi self.wsgi = self.app.wsgi() File “/usr/local/lib/python3.8/dist-packages/gunicorn/app/base.py”, line 67, in wsgi self.callable = self.load() File “/usr/local/lib/python3.8/dist-packages/gunicorn/app/wsgiapp.py”, line 49, in load return self.load_wsgiapp() File “/usr/local/lib/python3.8/dist-packages/gunicorn/app/wsgiapp.py”, line 39, in load_wsgiapp return util.import_app(self.app_uri) File “/usr/local/lib/python3.8/dist-packages/gunicorn/util.py”, line 358, in import_app mod = importlib.import_module(module) File “/usr/lib/python3.8/importlib/init.py”, line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File “<frozen importlib._bootstrap>”, line 1014, in _gcd_import File “<frozen importlib._bootstrap>”, line 991, in _find_and_load File “<frozen importlib._bootstrap>”, line 975, in _find_and_load_unlocked File “<frozen importlib._bootstrap>”, line 671, in _load_unlocked File “<frozen importlib._bootstrap_external>”, line 848, in exec_module File “<frozen importlib._bootstrap>”, line 219, in _call_with_frames_removed File “/app/index.py”, line 1, in <module> import dash_bootstrap_components as dbc File “/usr/local/lib/python3.8/dist-packages/dash_bootstrap_components/init.py”, line 5, in <module> from dash_bootstrap_components import _components, icons, themes File “/usr/local/lib/python3.8/dist-packages/dash_bootstrap_components/_components/init.py”, line 1, in <module> from .Accordion import Accordion File “/usr/local/lib/python3.8/dist-packages/dash_bootstrap_components/_components/Accordion.py”, line 3, in <module> from dash.development.base_component import Component, _explicitize_args File “/usr/local/lib/python3.8/dist-packages/dash/init.py”, line 5, in <module> from .dependencies import ( # noqa: F401,E402 File “/usr/local/lib/python3.8/dist-packages/dash/dependencies.py”, line 4, in <module> from ._validate import validate_callback File “/usr/local/lib/python3.8/dist-packages/dash/_validate.py”, line 5, in <module> import flask File “/usr/local/lib/python3.8/dist-packages/flask/init.py”, line 4, in <module> from . import json as json File “/usr/local/lib/python3.8/dist-packages/flask/json/init.py”, line 8, in <module> from …globals import current_app File “/usr/local/lib/python3.8/dist-packages/flask/globals.py”, line 56, in <module> app_ctx: “AppContext” = LocalProxy( # type: ignore[assignment] TypeError: init() got an unexpected keyword argument ‘unbound_message’ [2022-08-08 11:24:34 +0200] [8] [INFO] Worker exiting (pid: 8) [2022-08-08 11:24:34 +0200] [9] [ERROR] Exception in worker process Traceback (most recent call last): File “/usr/local/lib/python3.8/dist-packages/gunicorn/arbiter.py”, line 583, in spawn_worker worker.init_process() File “/usr/local/lib/python3.8/dist-packages/gunicorn/workers/base.py”, line 119, in init_process self.load_wsgi() File “/usr/local/lib/python3.8/dist-packages/gunicorn/workers/base.py”, line 144, in load_wsgi self.wsgi = self.app.wsgi() File “/usr/local/lib/python3.8/dist-packages/gunicorn/app/base.py”, line 67, in wsgi self.callable = self.load() File “/usr/local/lib/python3.8/dist-packages/gunicorn/app/wsgiapp.py”, line 49, in load return self.load_wsgiapp() File “/usr/local/lib/python3.8/dist-packages/gunicorn/app/wsgiapp.py”, line 39, in load_wsgiapp return util.import_app(self.app_uri) File “/usr/local/lib/python3.8/dist-packages/gunicorn/util.py”, line 358, in import_app mod = importlib.import_module(module) File “/usr/lib/python3.8/importlib/init.py”, line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File “<frozen importlib._bootstrap>”, line 1014, in _gcd_import File “<frozen importlib._bootstrap>”, line 991, in _find_and_load File “<frozen importlib._bootstrap>”, line 975, in _find_and_load_unlocked File “<frozen importlib._bootstrap>”, line 671, in _load_unlocked File “<frozen importlib._bootstrap_external>”, line 848, in exec_module File “<frozen importlib._bootstrap>”, line 219, in _call_with_frames_removed File “/app/index.py”, line 1, in <module> import dash_bootstrap_components as dbc File “/usr/local/lib/python3.8/dist-packages/dash_bootstrap_components/init.py”, line 5, in <module> from dash_bootstrap_components import _components, icons, themes File “/usr/local/lib/python3.8/dist-packages/dash_bootstrap_components/_components/init.py”, line 1, in <module> from .Accordion import Accordion File “/usr/local/lib/python3.8/dist-packages/dash_bootstrap_components/_components/Accordion.py”, line 3, in <module> from dash.development.base_component import Component, _explicitize_args File “/usr/local/lib/python3.8/dist-packages/dash/init.py”, line 5, in <module> from .dependencies import ( # noqa: F401,E402 File “/usr/local/lib/python3.8/dist-packages/dash/dependencies.py”, line 4, in <module> from ._validate import validate_callback File “/usr/local/lib/python3.8/dist-packages/dash/_validate.py”, line 5, in <module> import flask File “/usr/local/lib/python3.8/dist-packages/flask/init.py”, line 4, in <module> from . import json as json File “/usr/local/lib/python3.8/dist-packages/flask/json/init.py”, line 8, in <module> from …globals import current_app File “/usr/local/lib/python3.8/dist-packages/flask/globals.py”, line 56, in <module> app_ctx: “AppContext” = LocalProxy( # type: ignore[assignment] TypeError: init() got an unexpected keyword argument ‘unbound_message’ [2022-08-08 11:24:34 +0200] [9] [INFO] Worker exiting (pid: 9) [2022-08-08 11:24:34 +0200] [10] [ERROR] Exception in worker process Traceback (most recent call last): File “/usr/local/lib/python3.8/dist-packages/gunicorn/arbiter.py”, line 583, in spawn_worker worker.init_process() File “/usr/local/lib/python3.8/dist-packages/gunicorn/workers/base.py”, line 119, in init_process self.load_wsgi() File “/usr/local/lib/python3.8/dist-packages/gunicorn/workers/base.py”, line 144, in load_wsgi self.wsgi = self.app.wsgi() File “/usr/local/lib/python3.8/dist-packages/gunicorn/app/base.py”, line 67, in wsgi self.callable = self.load() File “/usr/local/lib/python3.8/dist-packages/gunicorn/app/wsgiapp.py”, line 49, in load return self.load_wsgiapp() File “/usr/local/lib/python3.8/dist-packages/gunicorn/app/wsgiapp.py”, line 39, in load_wsgiapp return util.import_app(self.app_uri) File “/usr/local/lib/python3.8/dist-packages/gunicorn/util.py”, line 358, in import_app mod = importlib.import_module(module) File “/usr/lib/python3.8/importlib/init.py”, line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File “<frozen importlib._bootstrap>”, line 1014, in _gcd_import File “<frozen importlib._bootstrap>”, line 991, in _find_and_load File “<frozen importlib._bootstrap>”, line 975, in _find_and_load_unlocked File “<frozen importlib._bootstrap>”, line 671, in _load_unlocked File “<frozen importlib._bootstrap_external>”, line 848, in exec_module File “<frozen importlib._bootstrap>”, line 219, in _call_with_frames_removed File “/app/index.py”, line 1, in <module> import dash_bootstrap_components as dbc File “/usr/local/lib/python3.8/dist-packages/dash_bootstrap_components/init.py”, line 5, in <module> from dash_bootstrap_components import _components, icons, themes File “/usr/local/lib/python3.8/dist-packages/dash_bootstrap_components/_components/init.py”, line 1, in <module> from .Accordion import Accordion File “/usr/local/lib/python3.8/dist-packages/dash_bootstrap_components/_components/Accordion.py”, line 3, in <module> from dash.development.base_component import Component, _explicitize_args File “/usr/local/lib/python3.8/dist-packages/dash/init.py”, line 5, in <module> from .dependencies import ( # noqa: F401,E402 File “/usr/local/lib/python3.8/dist-packages/dash/dependencies.py”, line 4, in <module> from ._validate import validate_callback File “/usr/local/lib/python3.8/dist-packages/dash/_validate.py”, line 5, in <module> import flask File “/usr/local/lib/python3.8/dist-packages/flask/init.py”, line 4, in <module> from . import json as json File “/usr/local/lib/python3.8/dist-packages/flask/json/init.py”, line 8, in <module> from …globals import current_app File “/usr/local/lib/python3.8/dist-packages/flask/globals.py”, line 56, in <module> app_ctx: “AppContext” = LocalProxy( # type: ignore[assignment] TypeError: init() got an unexpected keyword argument ‘unbound_message’ [2022-08-08 11:24:34 +0200] [10] [INFO] Worker exiting (pid: 10) Traceback (most recent call last): File “/usr/local/lib/python3.8/dist-packages/gunicorn/arbiter.py”, line 202, in run self.manage_workers() File “/usr/local/lib/python3.8/dist-packages/gunicorn/arbiter.py”, line 545, in manage_workers self.spawn_workers() File “/usr/local/lib/python3.8/dist-packages/gunicorn/arbiter.py”, line 617, in spawn_workers time.sleep(0.1 * random.random()) File “/usr/local/lib/python3.8/dist-packages/gunicorn/arbiter.py”, line 242, in handle_chld self.reap_workers() File “/usr/local/lib/python3.8/dist-packages/gunicorn/arbiter.py”, line 525, in reap_workers raise HaltServer(reason, self.WORKER_BOOT_ERROR) gunicorn.errors.HaltServer: <HaltServer ‘Worker failed to boot.’ 3>
Expected behavior
Starting of the server and listening to port in localhost.
Thank you very much for the help!
Issue Analytics
- State:
- Created a year ago
- Comments:5 (4 by maintainers)
Top Related StackOverflow Question
@hannahker Yes, this happen when flask 2.2.x is installed but not werkzeug, possibly because werkzeug version was locked in requirements.txt but not flask
I’ve also had a report of this error coming up with a slightly different stack trace:
Downgrading Flask resolved this. @T4rk1n do you think this is the same version mismatch problem?