lmcinnes / lmcinnes/umap

Error with importing umap.plot

Open
#906 1 comment 0 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

How do I fix the error below while importing umap.plot:

import numpy as np
import sklearn.datasets
import pandas as pd

import umap
import umap.plot

The error reads as follows:

TypeError Traceback (most recent call last)
C:\Temp/ipykernel_13404/29503139.py in
4
5 import umap
----> 6 import umap.plot

~\anaconda3\lib\site-packages\umap\plot.py in
5 try:
6 import pandas as pd
----> 7 import datashader as ds
8 import datashader.transfer_functions as tf
9 import datashader.bundling as bd

~\anaconda3\lib\site-packages\datashader\__init__.py in
6 __version__ = str(param.version.Version(fpath=__file__, archive_commit="$Format:%h$",reponame="datashader"))
7
----> 8 from .core import Canvas # noqa (API import)
9 from .reductions import * # noqa (API import)
10 from .glyphs import Point # noqa (API import)

~\anaconda3\lib\site-packages\datashader\core.py in
8 import dask.dataframe as dd
9 import dask.array as da
---> 10 from xarray import DataArray, Dataset
11 from collections import OrderedDict
12

~\anaconda3\lib\site-packages\xarray\__init__.py in
----> 1 from . import testing, tutorial
2 from .backends.api import (
3 load_dataarray,
4 load_dataset,
5 open_dataarray,

~\anaconda3\lib\site-packages\xarray\testing.py in
7 import pandas as pd
8
----> 9 from xarray.core import duck_array_ops, formatting, utils
10 from xarray.core.dataarray import DataArray
11 from xarray.core.dataset import Dataset

~\anaconda3\lib\site-packages\xarray\core\duck_array_ops.py in
24 from numpy import where as _where
25
---> 26 from . import dask_array_compat, dask_array_ops, dtypes, npcompat, nputils
27 from .nputils import nanfirst, nanlast
28 from .pycompat import cupy_array_type, dask_array_type, is_duck_dask_array

~\anaconda3\lib\site-packages\xarray\core\npcompat.py in
70 List[Any],
71 # anything with a dtype attribute
---> 72 _SupportsDType[np.dtype],
73 ]
74 except ImportError:

~\anaconda3\lib\typing.py in inner(*args, **kwds)
273 except TypeError:
274 pass # All real errors (not unhashable args) are raised below.
--> 275 return func(*args, **kwds)
276 return inner
277

~\anaconda3\lib\typing.py in __class_getitem__(cls, params)
997 else:
998 # Subscripting a regular Generic subclass.
--> 999 _check_generic(cls, params, len(cls.__parameters__))
1000 return _GenericAlias(cls, params)
1001

~\anaconda3\lib\typing.py in _check_generic(cls, parameters, elen)
207 """
208 if not elen:
--> 209 raise TypeError(f"{cls} is not a generic class")
210 alen = len(parameters)
211 if alen != elen:

TypeError: is not a generic class

I am currently using python (v. 3.9.7) and umap-learn (v.0.5.3). Which specific library/package/module do I need to import if this error was caused by failing to import any module (e.g., datashader ... etc)? Thank you for your answer in advance!!

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 with the import chain shown in umap/plot.py, following the traceback through datashader and xarray to the numpy typing error. Reproduce it with Python 3.9.7 and umap-learn 0.5.3, then identify and document the compatible dependency combination or a clear fix for importing umap.plot.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy, 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.