Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ModuleNotFoundError installing yellowbrick in Python

I am having trouble installing yellowbrick.

I am using Anaconda, hence I took advantage of using the "conda install".

# set number of clusters
kclusters = 5

pittsburgh_grouped_clustering = pittsburgh_grouped.drop('Neighborhood', 1)

X = pittsburgh_grouped.drop('Neighborhood', 1)

from sklearn.cluster import KMeans
!conda install -c districtdatalabs yellowbrick
from yellowbrick.cluster import KElbowVisualizer

# instantiate the model and visualizer
model = KMeans()
visualizer = KElbowVisualizer(model, k=(1,10))

visualizer.fit(X) # fit data to visualizer
visualizer.poof() # draw/show/poof the data

I expect the package to be installed. The error message I am receiving is:

ModuleNotFoundError: No module named 'yellowbrick'.

What am I missing?

like image 401
Mo Kaiser Avatar asked Dec 22 '22 22:12

Mo Kaiser


1 Answers

First install yellowbrick outside of your code and verify that it actually installed. You can do this through the terminal doing exactly what you say. You may need to upgrade/downgrade your libraries which may not be happening when you install in your script.

Then try and run your script without the !conda install -c districtdatalabs yellowbrick because once its installed you don't have to install it again.

like image 110
BenT Avatar answered Dec 25 '22 12:12

BenT