9

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?

Kate Orlova
  • 3,225
  • 5
  • 11
  • 35
Mo Kaiser
  • 127
  • 1
  • 1
  • 5

3 Answers3

9

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.

BenT
  • 3,172
  • 3
  • 18
  • 38
  • 1
    For some reason the "!conda install" was not working even though I was using a Jupyter notebook in Anaconda. I used "!pip install yellowbrick", and it was successfully installed/imported. Thank you for your response! :) – Mo Kaiser Jul 10 '19 at 17:39
4

Steps to follow:

  1. Open Anaconda Navigator
  2. Environments
  3. Open Terminal
  4. Copy-paste "pip install yellowbrick"
Baran
  • 63
  • 5
0

My experienced the same thing but I tried and it worked by using the following steps :

  1. Open search on your windows
  2. Look for anaconda prompt, and click
  3. conda install -c districtdatalabs yellowbrick (use the following script to install the yellowbrick module) enter image description here

Where do I get the script from? Here I attach the link: https://anaconda.org/DistrictDataLabs/yellowbrick

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Aug 26 '22 at 16:31