dash_bootstrap_components installed succesfully but no recognised

2024/9/29 7:22:07

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

Answer

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 dbcapp = 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)
https://en.xdnf.cn/q/71241.html

Related Q&A

Efficient updates of image plots in Bokeh for interactive visualization

Im trying to create a smooth interactive visualization of different slices of a muldimensional array using Bokeh. The data in the slices changes according to the user interaction and thus has to be upd…

AttributeError: module cv2.cv2 has no attribute TrackerMOSSE_create

As the Dans suggestion, i tried to edit this post Error occurred at setting up MOOSE tracker, I also dont know why this error happened because i installed the Opencv-contrib-python==4.5.1.48.However,af…

Python, Error audio Recording in 16000Hz using Pyaudio

I use Python 2.7.3, Mac OS 10.8.2 and Xcode 4.5.1I am trying to record sound using PyAudio following the instructions in http://people.csail.mit.edu/hubert/pyaudio/and using the program ""&qu…

FastAPI passing json in get request via TestClient

Im try to test the api I wrote with Fastapi. I have the following method in my router : @app.get(/webrecord/check_if_object_exist) async def check_if_object_exist(payload: WebRecord) -> bool:key = g…

Python TDD directory structure

Is there a particular directory structure used for TDD in Python?Tutorials talk about the content of the tests, but not where to place themFrom poking around Python Koans, suspect its something like:/…

Pillow was built without XCB support

Im working on a program that uses ImageGrab in Pillow. I am getting the error mentioned in the title. I notice in the documentation that it says the generic pip install Pillow doesnt come with libxcb. …

Set equal aspect in plot with colorbar

I need to generate a plot with equal aspect in both axis and a colorbar to the right. Ive tried setting aspect=auto, aspect=1, and aspect=equal with no good results. See below for examples and the MWE.…

How to emit dataChanged in PyQt5

The code below breaks on self.emit line. It works fine in PyQt4. How to fix this code so it works in PyQt5?from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5.QtCore import QObject, pyqtSignalclass …

django: gettext and coercing to unicode

I have following code in my django application.class Status(object):def __init__(self, id, desc):self.id = idself.desc = descdef __unicode__(self):return self.descSTATUS = Status(0, _(u"Some text&…

Telegram bot api keyboard

I have problem with Telegram Bot Api and with "ReplyKeyboard". Im using Python 2.7 and I send post request:TelegramAPI.post(TELEGRAM_URL + "sendMessage", data=dict(chat_id=CHAT_ID, …