✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🐇 Announcing Dash VTK for 3d simulation graphics. Check out the March webinar.

Heroku deploy error: ModuleNotFoundError: No module named 'dash_bootstrap_components'

I am running into ModuleNotFoundError when deploying to heroku. I am able to deploy it locally:

python index.py

index.py contains:

if __name__ == '__main__':
    app.run_server(debug=True)

Here’s my file structure:

app.py
index.py
- assets
- tabs
-- tab1
-- tab2

Procfile (web: gunicorn index:app)
requirements.txt 

*dash==0.28.5*
*dash-core-components==0.34.0*
*dash-html-components==0.13.2*
*dash-renderer==0.14.3*
*dash-table-experiments==0.6.0*
*gunicorn==19.9.0*
*pandas==0.23.4*
*numpy==1.15.1*

Traceback from heroku logs

2020-06-07T06:59:16.571880+00:00 app[web.1]: __import__(module)

2020-06-07T06:59:16.571881+00:00 app[web.1]: File "/app/index.py", line 16, in <module>

2020-06-07T06:59:16.571881+00:00 app[web.1]: from app import app

2020-06-07T06:59:16.571881+00:00 app[web.1]: File "/app/app.py", line 5, in <module>

2020-06-07T06:59:16.571882+00:00 app[web.1]: import dash_bootstrap_components as dbc

2020-06-07T06:59:16.571887+00:00 app[web.1]: ModuleNotFoundError: No module named 'dash_bootstrap_components'

2020-06-07T06:59:16.576449+00:00 app[web.1]: [2020-06-07 06:59:16 +0000] [18] [INFO] Worker exiting (pid: 18)

2020-06-07T06:59:16.736465+00:00 heroku[router]: at=error code= **H13** desc="Connection closed without response" method= **GET** path="/" host=stroom-cre-platform.herokuapp.com request_id=f9c43b53-11a0-4de6-9c43-20cc6055b6c4 fwd="103.90.69.217" dyno=web.1 connect=1ms service=3126ms status=503 bytes=0 protocol=https

2020-06-07T06:59:16.836337+00:00 app[web.1]: [2020-06-07 06:59:16 +0000] [4] [INFO] Shutting down: Master

2020-06-07T06:59:16.836451+00:00 app[web.1]: [2020-06-07 06:59:16 +0000] [4] [INFO] Reason: Worker failed to boot.

2020-06-07T06:59:16.902396+00:00 heroku[web.1]: Process exited with status 3

2020-06-07T06:59:16.945296+00:00 heroku[web.1]: State changed from up to crashed

**2020-06-07T06:59:21.000000+00:00 app[api]:** Build succeeded

You are using a 3rd party module dash-bootstrap-components which you have not installed on the Heroku server. Try adding dash-bootstrap-components>=0.10.1 to your requirements.txt.

1 Like