# Error when draw UMAP: object has no attribute 'get\_cmap'

**URL:** <https://discourse.scverse.org/t/error-when-draw-umap-object-has-no-attribute-get-cmap/1726>\
**Category:** scanpy\
**Created:** [August 30, 2023, 8:28am UTC](https://discourse.scverse.org/t/error-when-draw-umap-object-has-no-attribute-get-cmap/1726 "2023-08-30T08:28:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![egoecho](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.scverse.org/egoecho/32/785_2.png) [@egoecho](https://discourse.scverse.org/u/egoecho)\
**Post date:** [August 30, 2023, 8:28am UTC](https://discourse.scverse.org/t/error-when-draw-umap-object-has-no-attribute-get-cmap/1726/1 "2023-08-30T08:28:59Z")

</div>

Error occurs when I draw UMAP using sc.pl.umap().

Version:  
Python 3.9.7  
scanpy 1.9.4

Run in Jupyter

```auto
import scanpy as sc
adata = sc.datasets.pbmc68k_reduced()
sc.pl.umap(adata)

```

Output

```auto
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[3], line 2
      1 adata = sc.datasets.pbmc68k_reduced()
----> 2 sc.pl.umap(adata)

File ~/.julia/conda/3/lib/python3.9/site-packages/scanpy/plotting/_tools/scatterplots.py:668, in umap(adata, **kwargs)
    609 @_wraps_plot_scatter
    610 @_doc_params(
    611 adata_color_etc=doc_adata_color_etc,
   (...)
    615 )
    616 def umap(adata, **kwargs) -> Union[Axes, List[Axes], None]:
    617 """\
    618 Scatter plot in UMAP basis.
    619 
   (...)
    666 tl.umap
    667 """
--> 668 return embedding(adata, 'umap', **kwargs)

File ~/.julia/conda/3/lib/python3.9/site-packages/scanpy/plotting/_tools/scatterplots.py:162, in embedding(adata, basis, color, gene_symbols, use_raw, sort_order, edges, edges_width, edges_color, neighbors_key, arrows, arrows_kwds, groups, components, dimensions, layer, projection, scale_factor, color_map, cmap, palette, na_color, na_in_legend, size, frameon, legend_fontsize, legend_fontweight, legend_loc, legend_fontoutline, colorbar_loc, vmax, vmin, vcenter, norm, add_outline, outline_width, outline_color, ncols, hspace, wspace, title, show, save, ax, return_fig, **kwargs)
    160 else:
    161 cmap = color_map
--> 162 cmap = copy(colormaps.get_cmap(cmap))
    163 cmap.set_bad(na_color)
    164 kwargs["cmap"] = cmap

AttributeError: 'ColormapRegistry' object has no attribute 'get_cmap'

```

---

<div class="post-metadata">

**Author:** ![ZWX19980516](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.scverse.org/zwx19980516/32/786_2.png) [@ZWX19980516](https://discourse.scverse.org/u/ZWX19980516)\
**Post date:** [August 30, 2023, 10:12am UTC](https://discourse.scverse.org/t/error-when-draw-umap-object-has-no-attribute-get-cmap/1726/2 "2023-08-30T10:12:25Z")

</div>

I also encountered the same problem and reinstalled it according to the official website tutorial. And solved it.

conda install -c conda-forge scanpy python-igraph leidenalg

---

<div class="post-metadata">

**Author:** ![egoecho](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.scverse.org/egoecho/32/785_2.png) [@egoecho](https://discourse.scverse.org/u/egoecho)\
**Post date:** [August 30, 2023, 12:05pm UTC](https://discourse.scverse.org/t/error-when-draw-umap-object-has-no-attribute-get-cmap/1726/3 "2023-08-30T12:05:58Z")

</div>

Thanks. Unfortunately reinstalling scanpy didn’t help. I guess this problem happened after I updated conda. So maybe the update of matplotlib leads to this error. May I ask which matplotlib version you are using without this problem? My version is 3.5.3.

---

<div class="post-metadata">

**Author:** ![ZWX19980516](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.scverse.org/zwx19980516/32/786_2.png) [@ZWX19980516](https://discourse.scverse.org/u/ZWX19980516)\
**Post date:** [August 30, 2023, 1:01pm UTC](https://discourse.scverse.org/t/error-when-draw-umap-object-has-no-attribute-get-cmap/1726/4 "2023-08-30T13:01:01Z")

</div>

My version is 3.7.2  
matplotlib-base 3.7.2 py311h54ef318\_0 conda-forge

---

<div class="post-metadata">

**Author:** ![egoecho](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.scverse.org/egoecho/32/785_2.png) [@egoecho](https://discourse.scverse.org/u/egoecho)\
**Post date:** [September 5, 2023, 7:29am UTC](https://discourse.scverse.org/t/error-when-draw-umap-object-has-no-attribute-get-cmap/1726/5 "2023-09-05T07:29:53Z")

</div>

I solved the problem by removing and reinstalling the whole conda. Now my matplotlib is 3.7.2 and scanpy works fine.
