Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError cannot import name 'BaseResponse' from 'werkzeug.wrappers' #4

Closed
mjmeijer opened this issue Apr 2, 2022 · 10 comments
Closed
Labels
bug Something isn't working serverside

Comments

@mjmeijer
Copy link
Owner

mjmeijer commented Apr 2, 2022

ImportError
cannot import name 'BaseResponse' from 'werkzeug.wrappers' (/layers/google.python.pip/pip/lib/python3.9/site-packages/werkzeug/wrappers/init.py)

Traceback (most recent call last): 
File "/layers/google.python.pip/pip/lib/python3.9/site-packages/gunicorn/arbiter.py", line 589, in spawn_worker worker.init_process() 
File "/layers/google.python.pip/pip/lib/python3.9/site-packages/gunicorn/workers/gthread.py", line 92, in init_process super().init_process() 
File "/layers/google.python.pip/pip/lib/python3.9/site-packages/gunicorn/workers/base.py", line 134, in init_process self.load_wsgi() 
File "/layers/google.python.pip/pip/lib/python3.9/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi self.wsgi = self.app.wsgi() 
File "/layers/google.python.pip/pip/lib/python3.9/site-packages/gunicorn/app/base.py", line 67, in wsgi self.callable = self.load() 
File "/layers/google.python.pip/pip/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 58, in load return self.load_wsgiapp() 
File "/layers/google.python.pip/pip/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp return util.import_app(self.app_uri) 
File "/layers/google.python.pip/pip/lib/python3.9/site-packages/gunicorn/util.py", line 359, in import_app mod = importlib.import_module(module) 
File "/opt/python3.9/lib/python3.9/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) 
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import 
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load 
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked 
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked 
File "<frozen importlib._bootstrap_external>", line 850, in exec_module 
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed 
File "/srv/main.py", line 16, in <module> from flask import Flask, Response, render_template, request, stream_with_context 
File "/layers/google.python.pip/pip/lib/python3.9/site-packages/flask/__init__.py", line 21, in <module> from .app import Flask 
File "/layers/google.python.pip/pip/lib/python3.9/site-packages/flask/app.py", line 32, in <module> from werkzeug.wrappers import BaseResponse ImportError: cannot import name 'BaseResponse' from 'werkzeug.wrappers' (/layers/google.python.pip/pip/lib/python3.9/site-packages/werkzeug/wrappers/__init__.py)

Service
default
Version
20220402t122141

@mjmeijer mjmeijer added bug Something isn't working serverside labels Apr 2, 2022
@mjmeijer
Copy link
Owner Author

mjmeijer commented Apr 2, 2022

Temp fix in requirements.txt:

werkzeug==2.0.3

@mjmeijer mjmeijer closed this as completed Apr 2, 2022
mjmeijer added a commit that referenced this issue Apr 2, 2022
@mjmeijer
Copy link
Owner Author

mjmeijer commented Apr 2, 2022

39308af

n8henrie added a commit to n8henrie/fauxmo that referenced this issue May 18, 2022
Workaround for error: `from werkzeug.wrappers import BaseResponse`

Thanks to: mjmeijer/donald_2021#4
@pushkalnath1216
Copy link

i could not find any werkzeug in requirements.py

@fbagci
Copy link

fbagci commented May 18, 2022

i could not find any werkzeug in requirements.py

type

pip install werkzeug==2.0.3

@pushkalnath1216
Copy link

ok thank you

@jdevng
Copy link

jdevng commented Jul 16, 2023

i could not find any werkzeug in requirements.py

type

pip install werkzeug==2.0.3

This isn't compatible with the latest version of flask, and 2.3.6 has the same issue::

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
flask 2.3.2 requires Werkzeug>=2.3.3, but you have werkzeug 2.0.3 which is incompatible.

@JensVoorpyl
Copy link

JensVoorpyl commented Jul 27, 2023

I have the same problem as @jdevng

n8henrie added a commit to n8henrie/fauxmo that referenced this issue Aug 25, 2023
Workaround for error: `from werkzeug.wrappers import BaseResponse`

Thanks to: mjmeijer/donald_2021#4
@NoorKhalifa
Copy link

pip install werkzeug --upgrade

then

pip install flask --upgrade

@frozenpandaman
Copy link

frozenpandaman commented Feb 21, 2024

For anyone encountering this still, I'm able to still use werkzeug 2.0.3 (on Flask 2.0.3 or 1.1.2) or werkzeug 2.2.2 (on Flask 2.2.2) but the requests library needs to be updated (e.g. 2.31.0 as of this comment) to fix the MutableMapping error from collections.

@determin1st
Copy link

determin1st commented Jun 2, 2024

3.0.3 same stuff, seem stable :]]
yeah, was able to run gunicorn/Flask thing with both Flask/Werkzeug 2.0.3/2.0.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working serverside
Projects
None yet
Development

No branches or pull requests

8 participants