Registry / web-framework / dash-core-components

dash-core-components

JSON →
library2.0.0pypypi✓ verified 28d ago

Dash Core Components (dcc) is a suite of interactive user interface components for building analytical web applications with Dash. It provides essential UI elements like dropdowns, sliders, graphs, and input fields. As of version 2.0.0, it is integrated directly into the main `dash` library, simplifying imports. Maintained by Plotly, its release cadence is tied to that of the overarching Dash framework, seeing significant updates with major Dash versions.

pip install dash
INSTALL
IMPORT
SIG · DASH-CORE-COMPONEN
D
dash-core-components
web-frameworkpythonv2.0.0
Install
8.1s avg
Import
1038ms
Disk
259MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
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
musl
py 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 1.068s · 217.2MB
glibc
py 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.
fix
Update 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.
fix
Upgrade 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.
fix
Explicitly 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`.
fix
Apply 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.
fix
Wrap 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.
fix
Change 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.
fix
Update 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.
fix
Before 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.
fix
Ensure 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.
fix
In 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+.
Agent activity
21 hits · last 30 days
node
18
OpenAI (training)
2
Resources
dash-core-components — pip install dash-core-components · libregistry