Error when draw UMAP: object has no attribute 'get_cmap'

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

Version:
Python 3.9.7
scanpy 1.9.4

Run in Jupyter

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

Output

---------------------------------------------------------------------------
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'


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

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.

My version is 3.7.2
matplotlib-base 3.7.2 py311h54ef318_0 conda-forge

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