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

Werkzeug updated. Getting errors #179

Closed
babyhuey opened this issue May 13, 2021 · 17 comments · Fixed by #187
Closed

Werkzeug updated. Getting errors #179

babyhuey opened this issue May 13, 2021 · 17 comments · Fixed by #187
Labels
bug dependencies Pull requests that update a dependency file help wanted

Comments

@babyhuey
Copy link

On Werkzeug 2.0, getting error:

[ERROR] Runtime.ImportModuleError: Unable to import module 'wsgi_handler': No module named 'werkzeug._compat' Traceback (most recent call last):

@babyhuey
Copy link
Author

Setting requirement werkzeug<2 fixes the deployment.

Looks like it mainly comes from the Python 2 compatibility stuff. Do you want to maintain Py2 compat? Or could I remove that

@avikalpg
Copy link

avikalpg commented May 15, 2021

I am running Python3 (Flask 2.0.0) and still getting this error.
This is the error that I am getting:

[ERROR] ModuleNotFoundError: No module named 'werkzeug._compat' Traceback (most recent call last): File "/var/task/serverless_sdk/__init__.py", line 144, in wrapped_handler return user_handler(event, context) File "/var/task/s_api.py", line 25, in error_handler raise e File "/var/task/s_api.py", line 20, in <module> user_handler = serverless_sdk.get_user_handler('wsgi_handler.handler') File "/var/task/serverless_sdk/__init__.py", line 56, in get_user_handler user_module = import_module(user_module_name) File "/var/lang/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 783, in exec_module File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "/var/task/wsgi_handler.py", line 22, in <module> import serverless_wsgi File "/var/task/serverless_wsgi.py", line 18, in <module> from werkzeug._compat import BytesIO, string_types, to_bytes, wsgi_encoding_dance

@babyhuey
Copy link
Author

@avikalpg You gotta go less than 2 werkzeug<2.

Version 1.0.1 is the latest <2 version that works

@avikalpg
Copy link

Yes, werkzeug<2.0.0 worked for me. I was just mentioning that the problem exists for Python3 as well. So that newer versions of the library can fix this issue.

I had to downgrade my Flask version as well to accommodate this change.

@shield007
Copy link

I think it makes sense to drop the python 2 support

@logandk
Copy link
Owner

logandk commented May 25, 2021

I agree, Python 2 support should be dropped - this will also allow for removal of a some of backwards-compatiblity code and outdated conventions in the library code itself.

@babyhuey
Copy link
Author

babyhuey commented May 25, 2021

@logandk would you prefer to fix this by pinning werkzeug<2 in the setup/requirements and make a version 1.7.8 or copy the _compat.py file over from werkzeug for 1.7.8

I'd like to work separately on creating a version 2.0 that drops support for python2 afterwards as well

@logandk
Copy link
Owner

logandk commented May 25, 2021

@babyhuey I think we should pin werkzeug<2 for 1.7.8 and then release 2.0.0 without python 2 support, as you suggested 👍

@logandk logandk added bug dependencies Pull requests that update a dependency file labels May 25, 2021
@babyhuey
Copy link
Author

Great! Looks like someone has already gone through the trouble of pinning to 1.0.1 here
#178

When can we expect you to merge this and create a new release?

@logandk
Copy link
Owner

logandk commented May 25, 2021

Thanks for pointing it out, I missed that PR. Will merge and release asap

@barrybarrette
Copy link
Contributor

Thanks for pointing it out, I missed that PR. Will merge and release asap

Hi @logandk, any update on this? I have a few projects pinned that I'd like to get back to latest on. Anything I can do to move this along?

Thanks

@shield007
Copy link

I don't think pinning it is a solution, atleast not for me. I'm trying to use latest flask (2.0.1), but with werkzeug pinned I get the following error:

The conflict is caused by:
    The user requested werkzeug==1.0.1
    The user requested werkzeug==1.0.1
    flask 2.0.0 depends on Werkzeug>=2.0

Makes sense since flask >= 2.0.0 requires newer Werkzeug. This now leaves me having to run old flask as well as werkzeug and probally other stuff over time.

@akats
Copy link

akats commented Jul 30, 2021

I'm still getting the same error with flask 2.0.4 with serverless-wsgi v. 1.7.8 . Any update on supporting Flask 2?

@logandk
Copy link
Owner

logandk commented Aug 2, 2021

The plan was to release serverless-wsgi 2.0.0 which drops Python 2 support and supports the latest Flask/Werkzeug. I don't have any time to allocate towards this in the near future, but I'm happy to accept a PR.

@Raraku
Copy link

Raraku commented Mar 16, 2022

Hi,
I am currently having this error. Is downgrading the only way to go?

@babyhuey
Copy link
Author

Hi, I am currently having this error. Is downgrading the only way to go?

No, it has been fixed. Upgrade werkzeug to >2 and serverless-wsgi to latest version and they work just fine!

@Raraku
Copy link

Raraku commented Mar 16, 2022

Yeah, thanks.
I forgot to update the serverless-wsgi in the package.json.

My bad

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug dependencies Pull requests that update a dependency file help wanted
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants