Some plotly graphs aren’t showing on my Dash dashboard hosted on Google App Engine but it shows locally

I have a fairly simple px.bar and px.scatter graph that’s not showing up on the dashboard deployed to Google App Engine (their free tier), though it’s displaying fine locally.

Graphs that aren’t showing on the dashboard
Same graphs, locally

The three graphs that aren’t displaying properly (and the KPI cards to the side) are all lumped in one callback. It doesn’t load no matter how long I let it load for.

Not sure if the code matters but here’s the layout and the callback code (Dash.plotly) in case it’s needed.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>dbc.Card(dbc.CardBody([
dbc.Row([
dbc.Col([
dbc.Stack([
html.H5("Select the number of customers to display"),
dcc.Slider(
id='filter-num-of-cust-slider-anal',
max=unique_customer_count_analysis,
marks=generate_marks(unique_customer_count_analysis, step=10),
min=1, value=10, step=1, tooltip={
"always_visible": True, "template": "{value} Customers"},
)
]),
dbc.Stack([
html.H5('Select the customer category'),
dcc.Dropdown(
options=customerCategory_dropdown_options,
id='filter-customer-category',
placeholder='Select customer category'
),
]),
dbc.Stack(
generate_highlight_cards("Average number of orders per week", html.P(id="val-avg-no-order-wk"), html.P(id="val-avg-no-order-wk-filter-txt"))
),
dbc.Stack(
generate_highlight_cards("Average order size", html.P(id='val-avg-ordersize-forAll'), html.P(id="val-avg-no-order-wk-filter-txt-2")),
),
dbc.Stack([
html.H5("Remove specific customers from the line graph"),
dcc.Dropdown(options=customer_dropdown_options_noAll,
id='filter-removeCustomers',
multi=True,
placeholder='Select customer to remove'
),
]),
], width=2, xl=2, xs=12),
dbc.Col([
dbc.Row([
dbc.Col([
dcc.Graph(id='fig-bar-customer-ord-habit'),
],width=6, xl=6, xs=12),
dbc.Col([
dcc.Graph(id='fig-bar-customer-ord-habit-orderPerWeek'),
], width=6,xl=6, xs=12),
dbc.Col([
dcc.Graph(id='fig-scatter-cust-orderHabit'),
], width=6, xl=6, xs=12),
dbc.Col([
dcc.Graph(figure=fig_cust_orderHabit_politicalCompass)
], width=6, xl=6, xs=12),
]),
],width=10, xl=10, xs=12)
])
])),
</code>
<code>dbc.Card(dbc.CardBody([ dbc.Row([ dbc.Col([ dbc.Stack([ html.H5("Select the number of customers to display"), dcc.Slider( id='filter-num-of-cust-slider-anal', max=unique_customer_count_analysis, marks=generate_marks(unique_customer_count_analysis, step=10), min=1, value=10, step=1, tooltip={ "always_visible": True, "template": "{value} Customers"}, ) ]), dbc.Stack([ html.H5('Select the customer category'), dcc.Dropdown( options=customerCategory_dropdown_options, id='filter-customer-category', placeholder='Select customer category' ), ]), dbc.Stack( generate_highlight_cards("Average number of orders per week", html.P(id="val-avg-no-order-wk"), html.P(id="val-avg-no-order-wk-filter-txt")) ), dbc.Stack( generate_highlight_cards("Average order size", html.P(id='val-avg-ordersize-forAll'), html.P(id="val-avg-no-order-wk-filter-txt-2")), ), dbc.Stack([ html.H5("Remove specific customers from the line graph"), dcc.Dropdown(options=customer_dropdown_options_noAll, id='filter-removeCustomers', multi=True, placeholder='Select customer to remove' ), ]), ], width=2, xl=2, xs=12), dbc.Col([ dbc.Row([ dbc.Col([ dcc.Graph(id='fig-bar-customer-ord-habit'), ],width=6, xl=6, xs=12), dbc.Col([ dcc.Graph(id='fig-bar-customer-ord-habit-orderPerWeek'), ], width=6,xl=6, xs=12), dbc.Col([ dcc.Graph(id='fig-scatter-cust-orderHabit'), ], width=6, xl=6, xs=12), dbc.Col([ dcc.Graph(figure=fig_cust_orderHabit_politicalCompass) ], width=6, xl=6, xs=12), ]), ],width=10, xl=10, xs=12) ]) ])), </code>
dbc.Card(dbc.CardBody([
        dbc.Row([
                dbc.Col([
                        dbc.Stack([
                                html.H5("Select the number of customers to display"),
                                dcc.Slider(
                                        id='filter-num-of-cust-slider-anal',
                                        max=unique_customer_count_analysis,
                                        marks=generate_marks(unique_customer_count_analysis, step=10),
                                        min=1, value=10, step=1, tooltip={
                                        "always_visible": True, "template": "{value} Customers"},
                                )
                        ]),
                        dbc.Stack([
                                html.H5('Select the customer category'),
                                dcc.Dropdown(
                                        options=customerCategory_dropdown_options,
                                        id='filter-customer-category',
                                        placeholder='Select customer category'
                                    
                                ),
                        ]),
                        dbc.Stack(
                                generate_highlight_cards("Average number of orders per week", html.P(id="val-avg-no-order-wk"), html.P(id="val-avg-no-order-wk-filter-txt"))
                        ),
                        dbc.Stack(
                                generate_highlight_cards("Average order size", html.P(id='val-avg-ordersize-forAll'), html.P(id="val-avg-no-order-wk-filter-txt-2")),
                        ),
                        dbc.Stack([
                                html.H5("Remove specific customers from the line graph"),
                                dcc.Dropdown(options=customer_dropdown_options_noAll, 
                                        id='filter-removeCustomers',
                                        multi=True,
                                        placeholder='Select customer to remove'
                                ),
                        ]),
                ], width=2, xl=2, xs=12),

                dbc.Col([
                        dbc.Row([   
                                dbc.Col([
                                        dcc.Graph(id='fig-bar-customer-ord-habit'), 
                                ],width=6, xl=6, xs=12),
                                dbc.Col([
                                        dcc.Graph(id='fig-bar-customer-ord-habit-orderPerWeek'),
                                ], width=6,xl=6, xs=12),
                                dbc.Col([
                                        dcc.Graph(id='fig-scatter-cust-orderHabit'),
                                ], width=6, xl=6, xs=12),
                                dbc.Col([
                                        dcc.Graph(figure=fig_cust_orderHabit_politicalCompass)
                                ], width=6, xl=6, xs=12),

                        ]),
                ],width=10, xl=10, xs=12)
        ])
])),
Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>@dash.callback(
[Output('fig-bar-customer-ord-habit', 'figure'),
Output('fig-bar-customer-ord-habit-orderPerWeek', 'figure'),
Output('fig-scatter-cust-orderHabit', 'figure'),
Output('val-avg-no-order-wk','children'),
Output('val-avg-no-order-wk-filter-txt', 'children'),
Output('val-avg-ordersize-forAll', 'children'),
Output('val-avg-no-order-wk-filter-txt-2', 'children')],
[Input('filter-num-of-cust-slider-anal', 'value'),
Input('filter-customer-category', 'value'),
Input('filter-removeCustomers','value')]
)
def update_fig_cust_orderHabit_bar(num_of_cust_slider, filter_custCat, filter_cust_remove):
df_filtered = df_salesWithSegmentation_main.copy()
filter_category_text = 'All categories'
# Filter based on the category
if filter_custCat:
if 'ALL' in filter_custCat:
filter_category_text = "All categories"
filter_custCat = df_filtered['Category'].unique().tolist()
if isinstance(filter_custCat, str):
filter_custCat = [filter_custCat]
filter_category_text = filter_custCat
df_filtered = df_filtered[df_filtered['Category'].isin(filter_custCat)]
average_orders_per_week, average_order_size = process_customer_data(df_filtered)
customer_summary = pd.merge(average_orders_per_week, average_order_size, on='Customer').sort_values(by="Average Order Size", ascending=False)
df_sorted_averageOrderSize = customer_summary.sort_values(by='Average Order Size', ascending=False).head(num_of_cust_slider).reset_index(drop=True)
df_sorted_orderPerWeek = customer_summary.sort_values(by='Average Orders per Week', ascending=False).head(num_of_cust_slider).reset_index(drop=True)
# Create the bar graph
fig_cust_orderHabit_bar = px.bar(df_sorted_averageOrderSize, x='Customer', y="Average Order Size", title="Customer Average Order Size")
fig_cust_orderHabit_bar_orderPerWeek = px.bar(df_sorted_orderPerWeek, x='Customer', y="Average Orders per Week", title="Customer Average Number of Orders Per Week")
if filter_cust_remove is None:
filter_cust_remove = [] # Default to an empty list if None
customer_summary_removeCustomers = customer_summary[~customer_summary.Customer.isin(filter_cust_remove)]
fig_cust_orderHabit = px.scatter(customer_summary_removeCustomers, x='Average Orders per Week', y='Average Order Size', color='Customer', trendline='ols', trendline_scope="overall", title="Customer Average Number of Orders per Week vs. Average Order Size")
fig_cust_orderHabit.update_layout(legend=dict(font=dict(size= 8)))
val_avg_no_order_perWeek = round(average_orders_per_week['Average Orders per Week'].mean(),2)
val_avg_ord_size_forAll = round(average_order_size['Average Order Size'].mean(),0)
filter_category_text = "for: " + ''.join(filter_category_text)
return [fig_cust_orderHabit_bar, fig_cust_orderHabit_bar_orderPerWeek, fig_cust_orderHabit, val_avg_no_order_perWeek, filter_category_text, val_avg_ord_size_forAll, filter_category_text]
</code>
<code>@dash.callback( [Output('fig-bar-customer-ord-habit', 'figure'), Output('fig-bar-customer-ord-habit-orderPerWeek', 'figure'), Output('fig-scatter-cust-orderHabit', 'figure'), Output('val-avg-no-order-wk','children'), Output('val-avg-no-order-wk-filter-txt', 'children'), Output('val-avg-ordersize-forAll', 'children'), Output('val-avg-no-order-wk-filter-txt-2', 'children')], [Input('filter-num-of-cust-slider-anal', 'value'), Input('filter-customer-category', 'value'), Input('filter-removeCustomers','value')] ) def update_fig_cust_orderHabit_bar(num_of_cust_slider, filter_custCat, filter_cust_remove): df_filtered = df_salesWithSegmentation_main.copy() filter_category_text = 'All categories' # Filter based on the category if filter_custCat: if 'ALL' in filter_custCat: filter_category_text = "All categories" filter_custCat = df_filtered['Category'].unique().tolist() if isinstance(filter_custCat, str): filter_custCat = [filter_custCat] filter_category_text = filter_custCat df_filtered = df_filtered[df_filtered['Category'].isin(filter_custCat)] average_orders_per_week, average_order_size = process_customer_data(df_filtered) customer_summary = pd.merge(average_orders_per_week, average_order_size, on='Customer').sort_values(by="Average Order Size", ascending=False) df_sorted_averageOrderSize = customer_summary.sort_values(by='Average Order Size', ascending=False).head(num_of_cust_slider).reset_index(drop=True) df_sorted_orderPerWeek = customer_summary.sort_values(by='Average Orders per Week', ascending=False).head(num_of_cust_slider).reset_index(drop=True) # Create the bar graph fig_cust_orderHabit_bar = px.bar(df_sorted_averageOrderSize, x='Customer', y="Average Order Size", title="Customer Average Order Size") fig_cust_orderHabit_bar_orderPerWeek = px.bar(df_sorted_orderPerWeek, x='Customer', y="Average Orders per Week", title="Customer Average Number of Orders Per Week") if filter_cust_remove is None: filter_cust_remove = [] # Default to an empty list if None customer_summary_removeCustomers = customer_summary[~customer_summary.Customer.isin(filter_cust_remove)] fig_cust_orderHabit = px.scatter(customer_summary_removeCustomers, x='Average Orders per Week', y='Average Order Size', color='Customer', trendline='ols', trendline_scope="overall", title="Customer Average Number of Orders per Week vs. Average Order Size") fig_cust_orderHabit.update_layout(legend=dict(font=dict(size= 8))) val_avg_no_order_perWeek = round(average_orders_per_week['Average Orders per Week'].mean(),2) val_avg_ord_size_forAll = round(average_order_size['Average Order Size'].mean(),0) filter_category_text = "for: " + ''.join(filter_category_text) return [fig_cust_orderHabit_bar, fig_cust_orderHabit_bar_orderPerWeek, fig_cust_orderHabit, val_avg_no_order_perWeek, filter_category_text, val_avg_ord_size_forAll, filter_category_text] </code>
@dash.callback(
    [Output('fig-bar-customer-ord-habit', 'figure'),
     Output('fig-bar-customer-ord-habit-orderPerWeek', 'figure'),
     Output('fig-scatter-cust-orderHabit', 'figure'),
     Output('val-avg-no-order-wk','children'),
     Output('val-avg-no-order-wk-filter-txt', 'children'),
     Output('val-avg-ordersize-forAll', 'children'),
     Output('val-avg-no-order-wk-filter-txt-2', 'children')],
    [Input('filter-num-of-cust-slider-anal', 'value'),
     Input('filter-customer-category', 'value'),
     Input('filter-removeCustomers','value')]
)
def update_fig_cust_orderHabit_bar(num_of_cust_slider, filter_custCat, filter_cust_remove):
    df_filtered = df_salesWithSegmentation_main.copy()
    
    filter_category_text = 'All categories'
    
    # Filter based on the category
    if filter_custCat:
        if 'ALL' in filter_custCat:
            filter_category_text = "All categories"
            filter_custCat = df_filtered['Category'].unique().tolist()
        
        if isinstance(filter_custCat, str):
            filter_custCat = [filter_custCat]
            filter_category_text = filter_custCat
        
        df_filtered = df_filtered[df_filtered['Category'].isin(filter_custCat)]
    
    average_orders_per_week, average_order_size = process_customer_data(df_filtered)
    
    customer_summary = pd.merge(average_orders_per_week, average_order_size, on='Customer').sort_values(by="Average Order Size", ascending=False)

    df_sorted_averageOrderSize = customer_summary.sort_values(by='Average Order Size', ascending=False).head(num_of_cust_slider).reset_index(drop=True)
    df_sorted_orderPerWeek = customer_summary.sort_values(by='Average Orders per Week', ascending=False).head(num_of_cust_slider).reset_index(drop=True)
    # Create the bar graph
    fig_cust_orderHabit_bar = px.bar(df_sorted_averageOrderSize, x='Customer', y="Average Order Size", title="Customer Average Order Size")
    fig_cust_orderHabit_bar_orderPerWeek = px.bar(df_sorted_orderPerWeek, x='Customer', y="Average Orders per Week", title="Customer Average Number of Orders Per Week")

    if filter_cust_remove is None:
        filter_cust_remove = []  # Default to an empty list if None

    customer_summary_removeCustomers = customer_summary[~customer_summary.Customer.isin(filter_cust_remove)]
    fig_cust_orderHabit = px.scatter(customer_summary_removeCustomers, x='Average Orders per Week', y='Average Order Size', color='Customer', trendline='ols', trendline_scope="overall", title="Customer Average Number of Orders per Week vs. Average Order Size")
    fig_cust_orderHabit.update_layout(legend=dict(font=dict(size= 8)))
    val_avg_no_order_perWeek = round(average_orders_per_week['Average Orders per Week'].mean(),2)
    val_avg_ord_size_forAll = round(average_order_size['Average Order Size'].mean(),0)

    filter_category_text = "for: " + ''.join(filter_category_text)

    return [fig_cust_orderHabit_bar, fig_cust_orderHabit_bar_orderPerWeek, fig_cust_orderHabit, val_avg_no_order_perWeek, filter_category_text, val_avg_ord_size_forAll, filter_category_text]
  • The three graph uses the same dataset as the one on the bottom right, so the data’s loading.
    The callback is also working for the filters to the left (updating customer category updates the number of customers to display), so I’m not sure if this a question about Dash, Google App Engine, or whether I just messed up somewhere.
  • I have other bar & scatter graphs on the dashboard too, so it’s not an issue with the libraries.

I see this error in the GCP logs

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
<code>Traceback (most recent call last): File "/layers/google.python.pip/pip/lib/python3.11/site-packages/flask/app.py", line 1473, in wsgi_app response = self.full_dispatch_request()
</code>
<code>Traceback (most recent call last): File "/layers/google.python.pip/pip/lib/python3.11/site-packages/flask/app.py", line 1473, in wsgi_app response = self.full_dispatch_request() </code>
Traceback (most recent call last):   File "/layers/google.python.pip/pip/lib/python3.11/site-packages/flask/app.py", line 1473, in wsgi_app     response = self.full_dispatch_request() 

And it seems like people are saying requirements.txt or runtime is incorrect, but my other graphs are working so I doubt it’s this…

Any pointers on how I can troubleshoot would be appreciated, thanks.

New contributor

Peachy is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật