AnnMarieW / dash-bootstrap-templates

A collection of 52 Plotly figure templates with a Bootstrap theme. Two theme switch components. Stylesheet to apply Bootstrap themes to Plotly Dash components.
https://hellodash.pythonanywhere.com/
MIT License
135 stars 25 forks source link

ModuleNotFoundError: No module named 'dash_bootstrap_templates' #21

Closed hopezh closed 1 year ago

hopezh commented 1 year ago

My code:

from dash import Dash, callback, callback_context, dcc, dash_table, html, Input, Output, State
import dash_bootstrap_components as dbc
from dash_bootstrap_templates import load_figure_template
load_figure_template("darkly")

app = Dash(
    __name__,
    external_stylesheets=[
        dbc.themes.DARKLY,
        dbc.icons.FONT_AWESOME,
    ],
)

if __name__ == "__main__":
    app.run_server(debug=True)

The error:

Traceback (most recent call last):
  File "/Users/mi/Downloads/app.py", line 3, in <module>
    from dash_bootstrap_templates import load_figure_template
ModuleNotFoundError: No module named 'dash_bootstrap_templates'

I do have dash-bootstrap-templates installed:

pip show dash-bootstrap-templates

Name: dash-bootstrap-templates
Version: 1.1.0
Summary: A collection of Plotly figure templates with a Bootstrap theme
Home-page: https://github.com/AnnMarieW/dash-bootstrap-templates
Author: AnnMarieW
Author-email: 
License: MIT
Location: /opt/homebrew/lib/python3.11/site-packages
Requires: dash, dash-bootstrap-components, numpy
Required-by: 

May I ask why dash-bootstrap-templates is not recognized by python?

AnnMarieW commented 1 year ago

Hi @hopezh

I can't replicate the issue - it might be a virtual environment issue? Have you tried creating a new environment or uninstall/reinstall the library?

To see what version the program is actually running try adding this to the top of your code:

import dash_bootstrap_templates
print(dash_bootstrap_templates.__version__)
hopezh commented 1 year ago

Hi @AnnMarieW

Thank you.

Yes, it turns out that there was an error related to the Pillow package during my previous installation of dash-bootstrap-templates:

WARNING: Skipping /opt/homebrew/lib/python3.11/site-packages/Pillow-10.0.1-py3.11.egg-info due to invalid metadata entry 'name'

Reinstalling Pillow solves the issue.

Now, I can explore and enjoy dash-bootstrap-templates successfully.

> python

Python 3.10.12 | packaged by conda-forge | (main, Jun 23 2023, 22:39:40) [Clang 15.0.7 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import dash_bootstrap_templates
>>> print(dash_bootstrap_templates.__version__)
1.1.0