6

I have my dash working perfectly. I have installed dash_bootstrap_components to give style to my dash.

I wrote pip install dash-bootstrap-components and was perfectly installed.

But when I run the app, I have this error:

import dash_bootstrap_components as dbc

ModuleNotFoundError: No module named 'dash_bootstrap_components'

I have: dash-1.8.0 dash-bootstrap-components-0.8.2

Michel
  • 769
  • 4
  • 19
Papu
  • 121
  • 1
  • 1
  • 7

1 Answers1

6

I was having the same problem, I tried to install by following the instructions on their website: https://dash-bootstrap-components.opensource.faculty.ai/docs/quickstart/

In the terminal command-line I typed the following:

pip install dash-bootstrap-components

I got the following error:

Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: Consider using the --user option or check the permissions.

To solve it, you can do the following (the 1st one worked for me):

1) Install the package to the user folder:

python -m pip install --user dash-bootstrap-components

2) Setup a virtual env to install the package:

python3 -m venv env
source ./env/bin/activate 
python -m pip install dash-bootstrap-components

3) Use sudo to install to the system folder (not recommended):

sudo python -m pip install dash-bootstrap-components

After doing that it should work, you can create a file with the following code and run the server to see if it works:

import dash
import dash_bootstrap_components as dbc

app = dash.Dash(external_stylesheets=[dbc.themes.BOOTSTRAP])

app.layout = dbc.Container(
    dbc.Alert("Hello Bootstrap!", color="success"),
    className="p-5",
)

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



Eduardo Leite
  • 79
  • 1
  • 5