Skip to content

ImportError: cannot import name 'Table' from 'dash_bootstrap_components._components' #1069

@manalojamie0728

Description

@manalojamie0728

Before opening:

Please fill out the below information as much as possible.

  • dash version: 2.18.2
  • dash-bootstrap-components version: #1.7.0
  • components affected by bug: dash_bootstrap_components.Table

What is happening?

The Table component doesn't seem to be detected even though it should be there. Just upgraded from 1.6.0 to 1.7.0

What should be happening?

The Table component should be working properly, and thus, the Dash app.

Code

from dash import Dash, html
import dash_bootstrap_components as dbc

app = Dash()

table_header = [
    html.Thead(html.Tr([html.Th("First Name"), html.Th("Last Name")]))
]

row1 = html.Tr([html.Td("Arthur"), html.Td("Dent")])
row2 = html.Tr([html.Td("Ford"), html.Td("Prefect")])
row3 = html.Tr([html.Td("Zaphod"), html.Td("Beeblebrox")])
row4 = html.Tr([html.Td("Trillian"), html.Td("Astra")])

table_body = [html.Tbody([row1, row2, row3, row4])]

app.layout = [
    dbc.Table(table_header + table_body, bordered=True)
]

if __name__ == '__main__':
    app.run(debug=True)

Error messages

[2025-01-16 07:03:01 +0000] [2179] [ERROR] Exception in worker process
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/gunicorn/arbiter.py", line 608, in spawn_worker
    worker.init_process()
  File "/usr/local/lib/python3.12/site-packages/gunicorn/workers/base.py", line 135, in init_process
    self.load_wsgi()
  File "/usr/local/lib/python3.12/site-packages/gunicorn/workers/base.py", line 147, in load_wsgi
    self.wsgi = self.app.wsgi()
                ^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/gunicorn/app/base.py", line 66, in wsgi
    self.callable = self.load()
                    ^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/gunicorn/app/wsgiapp.py", line 57, in load
    return self.load_wsgiapp()
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/gunicorn/app/wsgiapp.py", line 47, in load_wsgiapp
    return util.import_app(self.app_uri)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/gunicorn/util.py", line 370, in import_app
    mod = importlib.import_module(module)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 999, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/code/iris/ui/wsgi.py", line 3, in <module>
    from .app import app
  File "/code/iris/ui/app.py", line 9, in <module>
    import dash_bootstrap_components as dbc
  File "/usr/local/lib/python3.12/site-packages/dash_bootstrap_components/__init__.py", line 7, in <module>
    from dash_bootstrap_components._components import Table
ImportError: cannot import name 'Table' from 'dash_bootstrap_components._components' (unknown location)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions