lmcinnes / lmcinnes/umap

AttributeError: module 'umap.plot' has no attribute 'output_notebook'

Open
#422 4 comments 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
8.3k
Forks
871
Avg merge
1d 13h
Merged PRs (30d)
5

Description

import umap
import umap.plot
umap.__version__

'0.4.2'.

After import umap in Jupyter notebook I get the same issue as in https://github.com/lmcinnes/umap/issues/321. I assumed that with version >0.4 it should have been resolved. Am I doing something wrong?

umap.plot.output_notebook()
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-2-c970ec05c096> in <module>
----> 1 umap.plot.output_notebook()

AttributeError: module 'umap.plot' has no attribute 'output_notebook'

And I indeed do not see 'output_notebook'

dir(umap.plot)
['Patch',
 '__builtins__',
 '__cached__',
 '__doc__',
 '__file__',
 '__loader__',
 '__name__',
 '__package__',
 '__spec__',
 '_blue',
 '_datashade_points',
 '_diagnostic_types',
 '_embed_datashader_in_an_axis',
 '_get_extent',
 '_green',
 '_matplotlib_points',
 '_nhood_compare',
 '_nhood_search',
 '_red',
 '_select_font_color',
 '_themes',
 '_to_hex',
 'bd',
 'bpl',
 'btr',
 'colorcet',
 'connectivity',
 'darkblue_cmap',
 'darkgreen_cmap',
 'darkpurple_cmap',
 'darkred_cmap',
 'deheap_sort',
 'diagnostic',
 'ds',
 'fire_cmap',
 'hd',
 'hv',
 'initialise_search',
 'initialized_nnd_search',
 'interactive',
 'matplotlib',
 'np',
 'numba',
 'pd',
 'plt',
 'points',
 'show',
 'show_interactive',
 'show_static',
 'sklearn',
 'submatrix',
 'tf',
 'warn']

As a workaround I use the function directly from bokeh

from bokeh.plotting import show, save, output_notebook, output_file

p = umap.plot.interactive(mapper, labels=labels, hover_data=hover_data)

And then I have to run the show command twice

output_notebook()
show(p)

In order not to get this error

RuntimeError: Models must be owned by only a single document, Circle(id='1036', ...) is already in a doc

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue in a Jupyter notebook with umap.plot.interactive and the Bokeh output_notebook workaround described in the report. Read the umap.plot interactive path and check how notebook output is initialized; done means output_notebook is available or clearly documented, and displaying the plot no longer requires repeated show calls or triggers the duplicate-document error.

Written by the indexing model from the issue text.

Assessment

Tech stack
jupyter-notebook, python
Domain
data-visualization, machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.