Error when importing Dash: “ImportError: DLL load failed while importing _brotli: The specified module could not be found.”

I’m following the tutorial on using Dash and trying the sample code found here: Part 2. Layout | Dash for Python Documentation | Plotly

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

Traceback (most recent call last):
  File "", 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\", 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\", 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\", line 10, in <module>
    import brotli
  File "C:\Users\lizsc\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\", 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 Import problem · Issue #782 · google/brotli · GitHub, 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!

I was having the same issue. I followed the instructions in your bullet point 6 and that solved it for me. There are multiple redists, did you install the correct one for your machine?

this is the exact issue I am having. Have you found a resolution?