DistrictDataLabs / yellowbrick

Visual analysis and diagnostic tools to facilitate machine learning model selection.
http://www.scikit-yb.org/
Apache License 2.0
4.3k stars 559 forks source link

UMAPVisualizer throws error 'umap package doesn't seem to be installed.' in spite of installing mmap-learn #1175

Closed 100mik closed 3 years ago

100mik commented 3 years ago

Bug Description UMAPVisualiser vas unable to detect package umap-learm

To Reproduce

def plot_UMAP(matrix, labels):
    umap = UMAPVisualizer(random_state=123)
    umap.fit(matrix, labels)
    umap.show()

Here matrix is a text corpus vectorised by HashingVectorizer labels is an array of integer labels provided by MiniBatchKMeans

Dataset It is a text corpus of stack traces internal to my organisation that has been pre-processed

Expected behavior I expect to see a scatter plot of my data points

Traceback

<ipython-input-146-9e04afb48ca4> in plot_UMAP(matrix, labels)
      1 def plot_UMAP(matrix, labels):
----> 2     umap = UMAPVisualizer(random_state=123)
      3     umap.fit(matrix, labels)
      4     umap.show()

~/Library/Python/3.8/lib/python/site-packages/yellowbrick/text/umap_vis.py in __init__(self, ax, labels, classes, colors, colormap, random_state, alpha, **kwargs)
    208         **kwargs
    209     ):
--> 210 
    211         raise YellowBrickValueError(e)
    212         if UMAP is None:

YellowbrickValueError: umap package doesn't seem to be installed.Please install UMAP via: pip install umap-learn

Desktop (please complete the following information):

Additional context I am running the project in a Jupyter Notebook. If it is of note, I tried to run from map import UMAP in the Python interpreter in a Jupyter Terminal instance and it worked. However running the same in the IPYNB notebook throws:

ImportError                               Traceback (most recent call last)
<ipython-input-150-d4c3909f4917> in <module>
----> 1 from umap import UMAP

ImportError: cannot import name 'UMAP' from 'umap' (/Users/soumikm/Library/Python/3.8/lib/python/site-packages/umap/__init__.py)

I believe the same ImportError is being caught leading to this error.

lwgray commented 3 years ago

Hi @100mik Thank you for using Yellowbrick. This appears to be an issue with your installation of the umap package and not a bug within yellowbrick.

My only suggestions would be to:

  1. uninstall then install umap-learn (which I am sure you have already done) 😄
  2. create a virtual environment and install yellowbrick and all other requirements within it

Maybe my teammates have some other suggests @DistrictDataLabs/team-oz

100mik commented 3 years ago

@lwgray Thank you so much for the response! I did trying reinstalling all packages involved. I will certainly give installing all dependencies in a virtual environment a shot. Please do let me know if you think something else might help me out. Thanks!

lwgray commented 3 years ago

@100mik Any progress on this issue? I am going to close it for now.