Install & Compatibility
Where this runs
tested against v? · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 1.068s · 217.2MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 8.1s · import 1.008s · 287MB
259MB installed
● package 259MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
dcc
✓ from dash import dcc
✗ import dash_core_components as dcc
Since Dash 2.0.0, core components are imported directly from the `dash` package. The `dash_core_components` package is now obsolete as a top-level import.
A minimal Dash application demonstrating the layout with a `dcc.Dropdown` component. This example initializes a Dash app, defines a simple layout containing a heading, a dropdown menu from `dcc`, and an empty div to display output (which would typically be updated by a callback).
from dash import Dash, html, dcc
app = Dash(__name__)
app.layout = html.Div([
html.H1("My Dash App with Core Components"),
dcc.Dropdown(
['New York City', 'Montréal', 'San Francisco'],
'Montréal',
id='city-dropdown'
),
html.Div(id='output-container')
])
# Callbacks would typically be added here for interactivity
if __name__ == '__main__':
app.run_server(debug=True)
Debug
Known issues
breakingDash 2.0.0 introduced a breaking change to import statements. Previously, `dash_core_components` was imported as a separate package. Now, `dcc` is imported directly from the `dash` namespace.fixUpdate your import statements from `import dash_core_components as dcc` to `from dash import dcc`. Ensure your `dash` package is version 2.0.0 or higher.
affects: dash-core-components < 2.0.0, dash < 2.0.0
breakingDash 2.0.0 (and thus dash-core-components 2.0.0) officially dropped support for Python 2. Applications using older Python versions will fail.fixUpgrade your Python environment to Python 3.6 or newer. (Dash typically supports the latest Python 3 versions).
affects: dash-core-components < 2.0.0, dash < 2.0.0 (when migrating to 2.x)
gotchaWhen defining callbacks in Dash 2.0.0+, if you are using `State` arguments in your `@app.callback` decorator, any `Input` arguments must now explicitly be named with `input=` (e.g., `Input(component_id='my-input', component_property='value')`). Previously, implicit naming was sometimes tolerated.fixExplicitly use `Input(component_id=..., component_property=...)` and `State(component_id=..., component_property=...)` keyword arguments in your callback decorator.
affects: dash >= 2.0.0
gotchaDash Core Components provide functionality but minimal default styling. For aesthetically pleasing and consistent layouts, it's highly recommended to use external CSS stylesheets or integrate with a component library like `dash-bootstrap-components`.fixApply custom CSS through the `assets` folder or utilize community-maintained styling libraries like `dash-bootstrap-components` (e.g., `pip install dash-bootstrap-components`).
affects: All versions
gotchaCallbacks that perform long-running operations can cause the UI to appear frozen. Use `dcc.Loading` to wrap components that are targets of such callbacks to provide visual feedback to the user.fixWrap your output components (or sections of your layout) with `dcc.Loading` to display a spinner while callbacks are executing. Example: `dcc.Loading(id="loading-output-1", children=html.Div(id="output-1"))`.
affects: All versions
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'dash_core_components'
As of Dash version 2.0.0, `dash_core_components` and `dash_html_components` were integrated directly into the main `dash` library, meaning they are no longer separate top-level packages to import from.
fixChange your import statements from `import dash_core_components as dcc` to `from dash import dcc`. Ensure your `dash` package is updated to version 2.0.0 or higher.
AttributeError: module 'dash_core_components' has no attribute 'Dropdown' (or 'Graph', 'Input', etc.)
This error occurs when attempting to access a component (like `Dropdown` or `Graph`) using the old `dash_core_components` module after upgrading to Dash 2.0.0, where components are now part of the `dash.dcc` submodule.
fixUpdate your import statements to `from dash import dcc` and then refer to components as `dcc.Dropdown`, `dcc.Graph`, etc.
TypeError: Object of type DataFrame is not JSON serializable
This error typically occurs when attempting to store a non-JSON-serializable Python object (such as a Pandas DataFrame, NumPy array, or custom class instance) directly into a `dcc.Store` component, which only supports JSON-compatible data.
fixBefore storing data in `dcc.Store`, convert the object into a JSON-serializable format, such as a dictionary, list, or string (e.g., using `df.to_json()` for DataFrames or `json.dumps()` for other objects), and then deserialize it in the callback when retrieved.
dcc.Dropdown value not displaying selection when `multi=True` and `value` is a string (instead of a list)
When `multi=True` is set for a `dcc.Dropdown`, its `value` property expects a list of selected values, even if only one item is selected. Providing a single string instead of a list will cause the selection not to be displayed correctly.
fixEnsure that when `multi=True`, the `value` property of `dcc.Dropdown` is always a list, for example, `value=['initial_selection']` instead of `value='initial_selection'`.
TypeError: 'Dash' object is not callable
This error often occurs in deployment scenarios, particularly with WSGI servers (like Gunicorn or uWSGI), when the WSGI application entry point is configured to call the `Dash` application instance directly, rather than its underlying Flask `server` attribute.
fixIn your WSGI configuration or entry file (e.g., `wsgi.py`), ensure that the application variable exposed to the WSGI server refers to `app.server` and not `app` itself. For example, if your Dash app is `app = dash.Dash(__name__)`, then the WSGI callable should point to `application = app.server`.
Upgrade
Version history
2.0.0latest on PyPI · released Mar 2, 2022
Audit
Dependencies
dashrequiredDash Core Components are bundled with and imported directly from the `dash` library since version 2.0.0.
orjsonoptionalOptional dependency for faster JSON serialization, improving callback performance in Dash 2.0+.