FS#70815 - [python-flask] ImportError: cannot import name 'ContextVar' from 'werkzeug.local'

Attached to Project: Community Packages
Opened by Keith Hughitt (khughitt) - Wednesday, 12 May 2021, 11:36 GMT
Last edited by Doug Newgard (Scimmia) - Friday, 14 May 2021, 12:20 GMT
Task Type Bug Report
Category Packages
Status Closed
Assigned To Sven-Hendrik Haase (Svenstaro)
Architecture All
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

After updating to the most recent version of python-flask (2.0.0-1), attempting to import flask results in an `ImportError` being generated, e.g:

```
import flask
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-117a6d41dbc4> in <module>
----> 1 import flask

/usr/lib/python3.9/site-packages/flask/__init__.py in <module>
5
6 from . import json
----> 7 from .app import Flask
8 from .app import Request
9 from .app import Response

/usr/lib/python3.9/site-packages/flask/app.py in <module>
17 from werkzeug.exceptions import HTTPException
18 from werkzeug.exceptions import InternalServerError
---> 19 from werkzeug.local import ContextVar
20 from werkzeug.routing import BuildError
21 from werkzeug.routing import Map

ImportError: cannot import name 'ContextVar' from 'werkzeug.local' (/usr/lib/python3.9/site-packages/werkzeug/local.py)
```

This also impacts other applications which attempt to use flask, such as the anki package.

System info:

- python 3.9.5
- python-flask 2.0.0-1
- python-werkzeug 1.0.1-4

To reproduce:

1. Run `python`
2. `import flask`
This task depends upon

Closed by  Doug Newgard (Scimmia)
Friday, 14 May 2021, 12:20 GMT
Reason for closing:  Fixed
Additional comments about closing:  python-werkzeug 2.0.0-1
Comment by Doug Newgard (Scimmia) - Wednesday, 12 May 2021, 12:08 GMT
Looks like it needs python-werkzeug 2.0.0+
Comment by Keith Hughitt (khughitt) - Thursday, 13 May 2021, 22:42 GMT
Good catch! werkzeug update indeed seems to have fixed the issue. Cheers.

Loading...