20

I'm trying to run a simple dash app in a conda environment in Pycharm, however I'm running into the error in the title. Weirdly enough, I couldn't find a place on the internet which has a mention of this bug, except for here. The code is simple, as all I'm trying to run is a simple dashapp; code obtained the code from here. I have tried switching between python versions in conda (back and forth between python 3.9, 3.8 and 3.7) but the error seems to be persistent. I know I have also correctly installed all its dependencies as I'm not getting any import error. Would appreciate if anyone could help with this.

Edit: Versions of Dash installed, as requested by @coralvanda : dash_versions

Basically, I just did a pip install of everything so all the versions of packages are the latest.

Screenshot of a full traceback of the error: traceback

quiccode
  • 313
  • 1
  • 3
  • 13

3 Answers3

13

I've been in the same problem.

Uninstall the wrong version with:

pip uninstall werkzeug

Install the right one with:

pip install -v https://github.com/pallets/werkzeug/archive/refs/tags/2.0.3.tar.gz
Cesarvspr
  • 301
  • 3
  • 9
  • Yep, it just so happened that Werkzeug released a new version on march 28, which I wasn't aware of, so rolling back to the previous version fixed it. – quiccode Mar 29 '22 at 04:53
  • Why not just upgrade with `pip install -U werkzeug`? – stefanbschneider Mar 29 '22 at 18:14
  • 2
    @CGFoX The new version that Werkzeug released yesterday broke dash and caused that import error. Since dash forces to install the latest version for every one of its dependencies, the latest version of Werkzeug got installed automatically by it. – quiccode Mar 29 '22 at 20:59
13

This is caused by dash and fixed in the new 2.3.1 release. So simply do:

pip install -U dash

If that doesn't help, you have to downgrade werkzeug manually, e.g.,

pip install werkzeug==2.0.3
stefanbschneider
  • 5,460
  • 8
  • 50
  • 88
5

This problem is not new, it effects Dash well back into the 1.x releases.

Both of the above answers have part of the solution (i.e. the one that worked for me).

It is a werkzeug error, but it is not enough to upgrade werkzeug for some reason. You must manually uninstall first, and then install the correct version next.

I am using Dash 1.20 and the latest version of werkzeug that worked for me is 2.0.3. So,

pip uninstall werkzeug

and

pip install werkzeug==2.0.3

Note: there must not be any spaces around the ==.
THIS WILL FAIL : pip install werkzeug == 2.0.3
THIS WILL work: pip install werkzeug==2.0.3

cssyphus
  • 37,875
  • 18
  • 96
  • 111