Cannot Import Name 'Baserequest'
I Am Building a Flask Lambda Application Using Aws Sam and My Requirements. Txt File Looks Like Follows Requests Contentful Flask-Lambda Numpy Recently the...
I am building a flask lambda application using AWS SAM and my requirements.txt file looks like follows requests contentful flask-lambda numpy Recently the flask lambda libraries were updated and since then i am getting the following error whenever i run the lambda function:
{"errorMessage": "Unable to import module 'app': cannot import name 'BaseRequest' from 'werkzeug.wrappers' (/var/task/werkzeug/wrappers/__init__.py)", "errorType": "Runtime.ImportModuleError", "requestId": "f6e80202-e6ca-4335-9b3c-f15b3a6496c1", "stackTrace": []}[ERROR] Runtime.ImportModuleError: Unable to import module 'app': cannot import name 'BaseRequest' from 'werkTraceback (most recent call last):/wrappers/__init__.py)
2 Answers
I fixed it by downgrading the package to Werkzeug==2.0.3 in requirements.txt
pip install werkzeug --upgrade
then
pip install flask --upgrade