Receiving Type Error unexpected keyword argument 'long_callback_manager' on Callbacks

I am trying to make a callback on an app that pulls data from an sql server. I can pull the data just fine into a pandas dataframe and format it into a Dash graph. However, if I add a callback (even one of the example callbacks for a simple button that returns text, not connected to my graph other than being on the same page) then I receive the following error:

TypeError: update_output() got an unexpected keyword argument ‘long_callback_manager’

This is what I have included in the file:

import pandas.io.sql
import pyodbc
import pandas as pd
import plotly.express as px
from datetime import date
from dash import Dash, dcc, html, DiskcacheManager
from dash.dependencies import Input, Output, State

I figured that maybe it wanted me to do a long_callback, so I setup the background manager by following the Dash tutorial page:

  import diskcache
  cache = diskcache.Cache("./cache")
  background_callback_manager = DiskcacheManager(cache)

And then setup the callback to be a background callback, but it still doesn’t work. The strange part is that even when I copied the tutorial basic callback and had it display at the top of the page above my graph, it still didn’t work (but if I just paste the tutorial code by itself in a py file, it works perfectly). Do callbacks not work if pyodbc is used on the page?

I tested a bit more and found that this error is caused by including (but not even using, just including!) the following:

from django_plotly_dash import DjangoDash

So I guess I can’t use Django Plotly Dash then? Or am I just using it incorrectly?

1 Like

For anyone who happens to get stuck on this like I did, I found the answer. It seems that when using Django_plotly_dash, you need to enter **kwargs in the callback, and that allows for it to work properly. For example, the callback should look something like this:

def update_output(n_clicks, start_date, end_date, **kwargs):

1 Like