Deploying Dash - H10 error

I am trying to deploy my first app, I followed all the steps required, but when I try to run it I get:

2019-11-02T19:13:35.901538+00:00 heroku[router]: at=error code=H10 desc=“App crashed” method=GET path="/" host=vit-dash-app-8486.herokuapp.com request_id=be5a0b67-3d5b-4ed2-b3f5-98f42ff354a8 fwd=“64.180.1.156” dyno= connect= service= status=503 bytes= protocol=https

2019-11-02T19:13:37.749622+00:00 heroku[router]: at=error code=H10 desc=“App crashed” method=GET path="/favicon.ico" host=vit-dash-app-8486.herokuapp.com request_id=46b75a76-175b-4055-b877-0bc69b1e68b0 fwd=“64.180.1.156” dyno= connect= service= status=503 bytes= protocol=https

This is my code:

import pandas as pd
import dash
import dash_table
import dash_html_components as html
import dash_core_components as dcc
import dash_table.FormatTemplate as FormatTemplate
from dash_table.Format import Sign
from dash.dependencies import Input, Output


sales = pd.read_excel('assets/sales.xls')

sales = sales.iloc[:][['Location','DOB','SDLY']]
var = ((sales['DOB']/sales['SDLY'])-1).round(3)
sales = pd.concat([sales,var], axis=1)
sales.columns=['Location','DOB','SDLY','Net Sales Variance']

guests = pd.read_excel('assets/guests.xls')

guests = guests.iloc[:][['Location','DOB','SDLY']]
var = ((guests['DOB']/guests['SDLY'])-1).round(3)
guests = pd.concat([guests,var], axis=1)
guests.columns=['Location','DOB','SDLY','Guest Count Variance']

data = sales.merge(guests, on='Location')

external_stylesheets=['https://codepen.io/chriddyp/pen/bWLwgP.css']

app = dash.Dash(__name__, external_stylesheets=external_stylesheets)

server = app.server

app.layout = html.Div([
	html.Div([
		html.H3('Daily Metrics',
				style={'textAlign': 'center',
					'padding':20}
				)
			]
		),
	html.Div([
		html.Div(id='graph',
			className='six columns'),
		html.Div([
		dash_table.DataTable(
			id='table',
			data=data.to_dict('records'),
            columns=[{
				'id': 'Location',
				'name': 'Location',
				'type': 'text'
				},
				{
				'name': 'Net Sales Variance',
                'id': 'Net Sales Variance',
                'type': 'numeric',
                'format': FormatTemplate.percentage(1).
							sign(Sign.positive)
                },
				{
				'name': 'Guest Count Variance',
                'id': 'Guest Count Variance',
                'type': 'numeric',
                'format': FormatTemplate.percentage(1).
							sign(Sign.positive)
                }
                ],
			style_as_list_view=True,
            sort_action='native',
            row_selectable="multi",
			fixed_rows={
				'headers': True, 'data': 0},
			style_cell={'width': '150px',
						'textAlign': 'left'},
			style_header={
				'backgroundColor': 'white',
				'fontWeight': 'bold',
				'textAlign': 'center'},
			style_data_conditional=[
			{
				'if': {'row_index': 'odd'},
				'backgroundColor': 'rgb(230, 230, 230)'
					},
			{
				"if": {"column_id": 'Net Sales Variance',
				'filter_query': '{Net Sales Variance} > 0'
					},
				"backgroundColor": "#D1FFBE",
					},		
			{
				"if": {"column_id": 'Net Sales Variance',
				'filter_query': '{Net Sales Variance} < 0'
					},
				"backgroundColor": "#FFBEBE",
					},	
			{
				"if": {"column_id": 'Guest Count Variance',
				'filter_query': '{Guest Count Variance} > 0'
					},
				"backgroundColor": "#D1FFBE",
					},		
			{
				"if": {"column_id": 'Guest Count Variance',
				'filter_query': '{Guest Count Variance} < 0'
					},
				"backgroundColor": "#FFBEBE",
					},	
			{
				"if": {"column_id": 'Location',
				'filter_query': '{Location} eq "Core Stores"'
					},
				"backgroundColor": "#FFFAAA",
				'fontWeight': 'bold',
					},	
				]
			),
			], className='five columns'),
		], className='row')
	])

@app.callback(
    Output('graph', "children"),
    [Input('table', "derived_virtual_data"),
     Input('table', "derived_virtual_selected_rows")])
     
def update_graphs(rows, derived_virtual_selected_rows):
	
	if derived_virtual_selected_rows is None:
		derived_virtual_selected_rows = []

	dff = data if rows is None else pd.DataFrame(rows)

	return [
		dcc.Graph(
			id=column,
			figure={
				"data": [
                    {
                        "x": dff["Location"],
                        "y": dff["Net Sales Variance"],
                        "type": "bar",
                        "name": "Net Sales",
                        "marker": {"color": 
							['#EC2D2D' if i in 
							derived_virtual_selected_rows 
							else '#FB9898' for i in range(len(dff))]},
                    },
                    {
                        "x": dff["Location"],
                        "y": dff["Guest Count Variance"],
                        "type": "bar",
                        "name": "Guest Count",
                        "marker": {"color": 
							['#3C2DEC' if i in 
							derived_virtual_selected_rows 
							else '#9D98FB' for i in range(len(dff))]},
                    }
                ],
                "layout": {
                    "xaxis": {"automargin": True},
                    "yaxis": {
                        "automargin": True,
                        "tickformat": ".0%",
                        "hoverformat": ".1%",
                    },
                    "legend": {
						"orientation": "h",
						"y": 1.15
                    },
                    "height": 500,
                    "width": 800,
                    "margin": {"t": 30, "l": 80, "r": 80, "b":30},
                },
            },
        )

        for column in ["Location"] 
		if column in dff
    ]

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

Am I doing something wrong?

The error logs you are sharing don’t look complete. You should search for a possible python runtimeerror in the logs. For example, a import error happens when you don’t update the requirements.txt file.

I have the requirements file and Procfile. Is there any chance that the problem is with the assets folder where I have two files that the code should read?

Capture

(venv) C:\Users\vspad\Desktop\my_dash_app>heroku logs --tail
2019-11-02T19:12:11.999098+00:00 app[web.1]: [2019-11-02 19:12:11 +0000] [10] [INFO] Booting worker with pid: 10
2019-11-02T19:12:12.006157+00:00 app[web.1]: [2019-11-02 19:12:12 +0000] [11] [INFO] Booting worker with pid: 11
2019-11-02T19:12:12.934189+00:00 heroku[web.1]: State changed from starting to up
2019-11-02T19:12:14.273318+00:00 app[web.1]: [2019-11-02 19:12:14 +0000] [10] [ERROR] Exception in worker process
2019-11-02T19:12:14.273346+00:00 app[web.1]: Traceback (most recent call last):
2019-11-02T19:12:14.27335+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py”, line 583, in spawn_worker
2019-11-02T19:12:14.273352+00:00 app[web.1]: worker.init_process()
2019-11-02T19:12:14.273354+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py”, line 129, in init_process
2019-11-02T19:12:14.273356+00:00 app[web.1]: self.load_wsgi()
2019-11-02T19:12:14.273358+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py”, line 138, in load_wsgi
2019-11-02T19:12:14.27336+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2019-11-02T19:12:14.273362+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py”, line 67, in wsgi
2019-11-02T19:12:14.273364+00:00 app[web.1]: self.callable = self.load()
2019-11-02T19:12:14.273366+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py”, line 52, in load
2019-11-02T19:12:14.273368+00:00 app[web.1]: return self.load_wsgiapp()
2019-11-02T19:12:14.27337+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py”, line 41, in load_wsgiapp
2019-11-02T19:12:14.273372+00:00 app[web.1]: return util.import_app(self.app_uri)
2019-11-02T19:12:14.273374+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/gunicorn/util.py”, line 350, in import_app
2019-11-02T19:12:14.273376+00:00 app[web.1]: import(module)
2019-11-02T19:12:14.273378+00:00 app[web.1]: File “/app/app1.py”, line 11, in
2019-11-02T19:12:14.27338+00:00 app[web.1]: sales = pd.read_excel(‘assets/sales.xls’)
2019-11-02T19:12:14.273383+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/pandas/util/_decorators.py”, line 208, in wrapper
2019-11-02T19:12:14.273385+00:00 app[web.1]: return func(*args, **kwargs)
2019-11-02T19:12:14.273387+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/pandas/io/excel/_base.py”, line 310, in read_excel
2019-11-02T19:12:14.273389+00:00 app[web.1]: io = ExcelFile(io, engine=engine)
2019-11-02T19:12:14.273391+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/pandas/io/excel/_base.py”, line 819, in init
2019-11-02T19:12:14.273394+00:00 app[web.1]: self._reader = self._enginesengine
2019-11-02T19:12:14.273396+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/pandas/io/excel/_xlrd.py”, line 20, in init
2019-11-02T19:12:14.273397+00:00 app[web.1]: import_optional_dependency(“xlrd”, extra=err_msg)
2019-11-02T19:12:14.2734+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/pandas/compat/_optional.py”, line 93, in import_optional_dependency
2019-11-02T19:12:14.273402+00:00 app[web.1]: raise ImportError(message.format(name=name, extra=extra)) from None
2019-11-02T19:12:14.273486+00:00 app[web.1]: ImportError: Missing optional dependency ‘xlrd’. Install xlrd >= 1.0.0 for Excel support Use pip or conda to install xlrd.
2019-11-02T19:12:14.275344+00:00 app[web.1]: [2019-11-02 19:12:14 +0000] [10] [INFO] Worker exiting (pid: 10)
2019-11-02T19:12:14.794867+00:00 app[web.1]: [2019-11-02 19:12:14 +0000] [11] [ERROR] Exception in worker process
2019-11-02T19:12:14.794875+00:00 app[web.1]: Traceback (most recent call last):
2019-11-02T19:12:14.794882+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py”, line 583, in spawn_worker
2019-11-02T19:12:14.794885+00:00 app[web.1]: worker.init_process()
2019-11-02T19:12:14.794887+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py”, line 129, in init_process
2019-11-02T19:12:14.794889+00:00 app[web.1]: self.load_wsgi()
2019-11-02T19:12:14.794891+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/gunicorn/workers/base.py”, line 138, in load_wsgi
2019-11-02T19:12:14.794893+00:00 app[web.1]: self.wsgi = self.app.wsgi()
2019-11-02T19:12:14.794895+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py”, line 67, in wsgi
2019-11-02T19:12:14.794897+00:00 app[web.1]: self.callable = self.load()
2019-11-02T19:12:14.794899+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py”, line 52, in load
2019-11-02T19:12:14.794901+00:00 app[web.1]: return self.load_wsgiapp()
2019-11-02T19:12:14.794903+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py”, line 41, in load_wsgiapp
2019-11-02T19:12:14.794905+00:00 app[web.1]: return util.import_app(self.app_uri)
2019-11-02T19:12:14.794906+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/gunicorn/util.py”, line 350, in import_app
2019-11-02T19:12:14.794908+00:00 app[web.1]: import(module)
2019-11-02T19:12:14.79491+00:00 app[web.1]: File “/app/app1.py”, line 11, in
2019-11-02T19:12:14.794912+00:00 app[web.1]: sales = pd.read_excel(‘assets/sales.xls’)
2019-11-02T19:12:14.794914+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/pandas/util/_decorators.py”, line 208, in wrapper
2019-11-02T19:12:14.794915+00:00 app[web.1]: return func(*args, **kwargs)
2019-11-02T19:12:14.794917+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/pandas/io/excel/_base.py”, line 310, in read_excel
2019-11-02T19:12:14.794919+00:00 app[web.1]: io = ExcelFile(io, engine=engine)
2019-11-02T19:12:14.79492+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/pandas/io/excel/_base.py”, line 819, in init
2019-11-02T19:12:14.794923+00:00 app[web.1]: self._reader = self._enginesengine
2019-11-02T19:12:14.794925+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/pandas/io/excel/_xlrd.py”, line 20, in init
2019-11-02T19:12:14.794927+00:00 app[web.1]: import_optional_dependency(“xlrd”, extra=err_msg)
2019-11-02T19:12:14.794932+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/pandas/compat/_optional.py”, line 93, in import_optional_dependency
2019-11-02T19:12:14.794933+00:00 app[web.1]: raise ImportError(message.format(name=name, extra=extra)) from None
2019-11-02T19:12:14.79494+00:00 app[web.1]: ImportError: Missing optional dependency ‘xlrd’. Install xlrd >= 1.0.0 for Excel support Use pip or conda to install xlrd.
2019-11-02T19:12:14.796275+00:00 app[web.1]: [2019-11-02 19:12:14 +0000] [11] [INFO] Worker exiting (pid: 11)
2019-11-02T19:12:15.021682+00:00 app[web.1]: Traceback (most recent call last):
2019-11-02T19:12:15.021687+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py”, line 210, in run
2019-11-02T19:12:15.022123+00:00 app[web.1]: self.sleep()
2019-11-02T19:12:15.022127+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py”, line 360, in sleep
2019-11-02T19:12:15.022344+00:00 app[web.1]: ready = select.select([self.PIPE[0]], [], [], 1.0)
2019-11-02T19:12:15.022353+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py”, line 245, in handle_chld
2019-11-02T19:12:15.022567+00:00 app[web.1]: self.reap_workers()
2019-11-02T19:12:15.022571+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py”, line 525, in reap_workers
2019-11-02T19:12:15.022831+00:00 app[web.1]: raise HaltServer(reason, self.WORKER_BOOT_ERROR)
2019-11-02T19:12:15.022927+00:00 app[web.1]: gunicorn.errors.HaltServer: <HaltServer ‘Worker failed to boot.’ 3>
2019-11-02T19:12:15.022934+00:00 app[web.1]:
2019-11-02T19:12:15.022937+00:00 app[web.1]: During handling of the above exception, another exception occurred:
2019-11-02T19:12:15.022938+00:00 app[web.1]:
2019-11-02T19:12:15.022941+00:00 app[web.1]: Traceback (most recent call last):
2019-11-02T19:12:15.022943+00:00 app[web.1]: File “/app/.heroku/python/bin/gunicorn”, line 11, in
2019-11-02T19:12:15.023071+00:00 app[web.1]: sys.exit(run())
2019-11-02T19:12:15.023079+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/wsgiapp.py”, line 61, in run
2019-11-02T19:12:15.023249+00:00 app[web.1]: WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
2019-11-02T19:12:15.023297+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py”, line 223, in run
2019-11-02T19:12:15.023537+00:00 app[web.1]: super(Application, self).run()
2019-11-02T19:12:15.023544+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/gunicorn/app/base.py”, line 72, in run
2019-11-02T19:12:15.023712+00:00 app[web.1]: Arbiter(self).run()
2019-11-02T19:12:15.023719+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py”, line 232, in run
2019-11-02T19:12:15.023924+00:00 app[web.1]: self.halt(reason=inst.reason, exit_status=inst.exit_status)
2019-11-02T19:12:15.023931+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py”, line 345, in halt
2019-11-02T19:12:15.024166+00:00 app[web.1]: self.stop()
2019-11-02T19:12:15.024169+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py”, line 393, in stop
2019-11-02T19:12:15.024413+00:00 app[web.1]: time.sleep(0.1)
2019-11-02T19:12:15.02446+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py”, line 245, in handle_chld
2019-11-02T19:12:15.024663+00:00 app[web.1]: self.reap_workers()
2019-11-02T19:12:15.02467+00:00 app[web.1]: File “/app/.heroku/python/lib/python3.6/site-packages/gunicorn/arbiter.py”, line 525, in reap_workers
2019-11-02T19:12:15.024955+00:00 app[web.1]: raise HaltServer(reason, self.WORKER_BOOT_ERROR)
2019-11-02T19:12:15.024959+00:00 app[web.1]: gunicorn.errors.HaltServer: <HaltServer ‘Worker failed to boot.’ 3>
2019-11-02T19:12:15.108427+00:00 heroku[web.1]: Process exited with status 1
2019-11-02T19:12:15.274494+00:00 heroku[web.1]: State changed from up to crashed
2019-11-02T19:13:35.901538+00:00 heroku[router]: at=error code=H10 desc=“App crashed” method=GET path="/" host=vit-dash-app-8486.herokuapp.com request_id=be5a0b67-3d5b-4ed2-b3f5-98f42ff354a8 fwd=“64.180.1.156” dyno= connect= service= status=503 bytes= protocol=https
2019-11-02T19:13:37.749622+00:00 heroku[router]: at=error code=H10 desc=“App crashed” method=GET path="/favicon.ico" host=vit-dash-app-8486.herokuapp.com request_id=46b75a76-175b-4055-b877-0bc69b1e68b0 fwd=“64.180.1.156” dyno= connect= service= status=503 bytes= protocol=https
2019-11-02T19:22:56.130801+00:00 heroku[router]: at=error code=H10 desc=“App crashed” method=GET path="/" host=vit-dash-app-8486.herokuapp.com request_id=2105f4d3-483c-423a-ad22-e14c937bcb67 fwd=“64.180.1.156” dyno= connect= service= status=503 bytes= protocol=http
2019-11-02T19:22:57.287903+00:00 heroku[router]: at=error code=H10 desc=“App crashed” method=GET path="/favicon.ico" host=vit-dash-app-8486.herokuapp.com request_id=d30ecfd5-4f74-4218-a82e-70a5f4d73852 fwd=“64.180.1.156” dyno= connect= service= status=503 bytes= protocol=http

The problem appears to be here

ImportError: Missing optional dependency ‘xlrd’. Install xlrd >= 1.0.0 for Excel support Use pip or conda to install xlrd.

You can probably fix it by adding xlrd to your requirements.txt.

1 Like

It worked, the issue was with xlrd.
https://vit-dash-first.herokuapp.com/

Thanks!