pythonnumpyscanpy

ModuleNotFoundError when running paga with scanpy


I tried running code below using scanpy library but for some reason it reports an error

ModuleNotFoundError: No module named 'igraph'
import numpy as np
import scanpy as sc 
import anndata

adata = anndata.AnnData(np.random.rand(300,300))
sc.tl.pca(adata, n_comps=30)
sc.pp.neighbors(adata, n_neighbors=16)
sc.tl.diffmap(adata, n_comps=50)
sc.tl.louvain(adata, resolution=1)
sc.pl.paga(adata)

Solution

  • You just need to run install igraph library using the command

    pip install python-igraph