8

I'm following the tutorial on using Dash and trying the sample code found here: https://dash.plotly.com/layout

After installing dash and running the code, I get the following error message in the traceback:

Traceback (most recent call last):
  File "app_example.py", line 7, in <module>
    import dash
  File "C:\Users\lizsc\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\dash\__init__.py", line 1, in <module>
    from .dash import Dash, no_update  # noqa: F401
  File "C:\Users\lizsc\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\dash\dash.py", line 18, in <module>
    from flask_compress import Compress
  File "C:\Users\lizsc\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\flask_compress.py", line 10, in <module>
    import brotli
  File "C:\Users\lizsc\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\brotli.py", line 8, in <module>
    import _brotli
ImportError: DLL load failed while importing _brotli: The specified module could not be found.

I'm using Windows 10, Python 3.8.5. Here are the fixes I've tried so far based on web search result recommendations:

  1. uninstalling dash, installing wheel, reinstalling dash -> no change in error message
  2. Uninstall and reinstall brotly -> no change in error message.
  3. Add C:\program files\Python38\scripts to PATH, uninstall and reinstall Dash -> no longer get "include this directory in PATH" warning message when installing Dash, but no change in traceback error message.
  4. As per suggestion from web search of error, installed matplotlib and imported matplotlib before importing dash -> results in different traceback error specific to matplotlib.
  5. Installed and ran virtualenv, installed dash on virtualenv and ran code-> no change in error message
  6. As per https://github.com/google/brotli/issues/782, installed vc_redist.x86.exe, restarted computer and ran outside of virtualenv-> no change in error message
  7. ran virtualenv after vc_redist.x86.exe was installed -> no change in error message

I definitely consider myself a novice, so any guidance would be appreciated!

pbaranski
  • 22,778
  • 19
  • 100
  • 117

4 Answers4

17

In my case helped installing both vc_redist:

x86: vc_redist.x86.exe
x64: vc_redist.x64.exe

from here https://support.microsoft.com/en-gb/help/2977003/the-latest-supported-visual-c-downloads

Additionally make sure that you updated Python/Windows and other software to newest versions and restarted machine.

Tested on Windows 10 Pro, Python 3.8.5, PyCharm 2020.2 .

pbaranski
  • 22,778
  • 19
  • 100
  • 117
1

In my case (windows 10 pro), I installed 'vc_redist.x64.exe'. you can click here for link to try for your device

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Mar 11 '22 at 07:00
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/late-answers/31262459) – ramzeek Mar 14 '22 at 04:27
0

Force reinstall dash using --user command:

pip install dash --force-reinstall --user
prosoitos
  • 6,679
  • 5
  • 27
  • 41
0

In my case, I had a problem with the module of dash named "Derkzeug". I followed the next steps:

pip list -> To verify the version 

pip install Werkzeuk==2.0.0 -> To downgrade the version of the module
Ethan
  • 876
  • 8
  • 18
  • 34