Why does Dash throw a TypeError when debugging through PyCharm?


When I try to run my Dash app from PyCharm in debug mode I keep getting the below TypeError. How can I fix it?


Dash 2.0.0, Python 3.9.6, PyCharm Community Edition 2021.1.3, Windows 10



Connected to pydev debugger (build 212.4746.96)
Traceback (most recent call last):
  File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 2021.1.3\plugins\python-ce\helpers\pydev\pydevd.py", line 1483, in _exec
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 2021.1.3\plugins\python-ce\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "C:/dev/github/urig/entropy/entropylab/results/dashboard/dashboard.py", line 170, in <module>
    _app = dash.Dash(__name__, external_stylesheets=[dbc.themes.DARKLY])
  File "C:\dev\github\urig\entropy\.venv\lib\site-packages\dash\dash.py", line 304, in __init__
    self.server = flask.Flask(name) if server else None
  File "C:\dev\github\urig\entropy\.venv\lib\site-packages\flask\app.py", line 406, in __init__
    instance_path = self.auto_find_instance_path()
  File "C:\dev\github\urig\entropy\.venv\lib\site-packages\flask\app.py", line 638, in auto_find_instance_path
    prefix, package_path = find_package(self.import_name)
  File "C:\dev\github\urig\entropy\.venv\lib\site-packages\flask\scaffold.py", line 850, in find_package
    package_path = _find_package_path(root_mod_name)
  File "C:\dev\github\urig\entropy\.venv\lib\site-packages\flask\scaffold.py", line 801, in _find_package_path
    return os.path.dirname(next(iter(spec.submodule_search_locations)))
TypeError: 'NoneType' object is not iterable

Process finished with exit code 1

PyCharm configuration:

Likely a bug in PyCharm. Solved by upgrading PyCharm to 2021.2.3.