Can anyone explain this error message? ImportError: cannot import name 'callback' from 'dash'

I have not made any significant changes, but I am suddenly receiving this error message. I added the statement "from dash import callback’ to each page with callbacks when I converted my app to a multi-page app days ago.

It has worked fine, more or less, as a multi-page app since then.

A search of this platform for this message produced no results, and a Google search search produced no results for this message either. I just don’t know what could cause it, so I have to ask a general question.

I am hoping maybe someone out there has tangled with his one already and knows the answer?

Here is a copy of the entire Traceback message.

It does not reference a page or line number in my code, though it does reference the init.py page in the Dash site package. That does not leave me with much of a starting point.

Never mind.

I figured it out. I had made a change that inadvertently led to installing a previous version of Dash.

You must be running the current version, Dash 2.0, for import callbacks to work.

It is working fine now.

Thanks.

1 Like

I don’ think I’ve ever had to from dash import callback before. Out of curiosity, how are you using that?

I’ve definitely used from dash import callback_context

For reference, here is the documentation regarding callbacks in v2.0:

It is mainly a convenience to avoid importing app when splitting the app in multiple modules (like for Multi-Page Apps).

Huh, learn something new everyday, did not know this.

Each page of my app has from app import app in every file on my multipage app. Will definitely be testing this!

1 Like