Skip to content

sc.pp.pca doesn't work after importing sparrow #209

@csangara

Description

@csangara

Hi guys,

I have a strange issue that I'm wondering whether you could provide some insight on. I provide a minimum example below with the PBMC dataset, but I have the same issue with any AnnData object.

import scanpy as sc
adata = sc.read_10x_mtx(
    "data/filtered_gene_bc_matrices/hg19/",  # the directory with the `.mtx` file
    var_names="gene_symbols",
    cache=True
)
sc.pp.normalize_total(adata, target_sum=1e4)
sc.pp.log1p(adata)
sc.pp.highly_variable_genes(adata)
sc.pp.scale(adata)
sc.pp.pca(adata)

So, the code above would just instantly run PCA:

computing PCA
    with n_comps=50
    finished (0:00:00)

but if I do this:

import sparrow
sc.pp.pca(adata)

The PCA would get stuck at

computing PCA
    with n_comps=50

without any error messages. I've left it for an hour before and it just keeps running.

When I used the debugger, it seems to be stuck at the svds function, but if I "Step Into" the function, the rest of the code runs normally.

My packages are scanpy==1.10.3 anndata==0.10.9 umap==0.5.6 numpy==1.26.4 scipy==1.14.1 pandas==2.2.3 scikit-learn==1.5.2 statsmodels==0.14.4 igraph==0.11.6 pynndescent==0.5.13

However, with a fresh install of Harpy, I don't have this issue anymore. (scanpy==1.10.4 anndata==0.11.1 umap==0.5.7 numpy==1.26.4 scipy==1.12.0 pandas==2.2.3 scikit-learn==1.5.2 statsmodels==0.14.4 igraph==0.11.8 pynndescent==0.5.13)

This is probably not very reproducible, but this has plagued me for a day, so I'm wondering if you have any ideas on what the cause could be.

Thanks!
Sai

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions