squidpy icon indicating copy to clipboard operation
squidpy copied to clipboard

The Kernel crashed while executing code in the current cell

Open spatts14 opened this issue 11 months ago • 3 comments

Hi! Thanks for writing Squidpy! Its really amazing!

I'm running into an issue and I'm not sure if its an issue with squidpy itself or how I'm running the code or space on my computer. I cannot run sq.gr.ligrec or sq.gr.spatial_autocorr without my kernel crashing. Is there something I am missing? Do I need to run this on the HPC?

Info about my data:

  • Xenium data
  • adata object is n_obs × n_vars = 53466 × 339
  • The size of the object is: 100039055 bytes (code: sys.getsizeof(adata))
  • The size of the object is: 151294272 bytes ( code: asizeof.asizeof(adata))

I've tried reducing my dataset to 0.2 and reducing the permutation to as low as 2 just to try to get it to work but every time I get the miss error:

The Kernel crashed while executing code in the current cell or a previous cell.

Please review the code in the cell(s) to identify a possible cause of the failure.

Here is the code I'm running

adata_subsample = sc.pp.subsample(adata, fraction=0.2, copy=True)
sq.gr.spatial_neighbors(adata_subsample, coord_type="generic", delaunay=True)
res = sq.gr.ligrec(
    adata,
    n_perms=2,
    cluster_key="new_clusters",
    copy=True,
    use_raw=False,
    transmitter_params={"categories": "ligand"},
    receiver_params={"categories": "receptor"},
)

and with the Moran I

adata_subsample = sc.pp.subsample(adata, fraction=0.2, copy=True)
sq.gr.spatial_neighbors(adata_subsample, coord_type="generic", delaunay=True)

sq.gr.spatial_autocorr(
    adata_subsample,
    mode="moran",
    n_perms=10,
    n_jobs=1,
)
adata_subsample.uns["moranI"].head(10)

...

Any suggestions would be really helpful!

spatts14 avatar Mar 22 '24 14:03 spatts14

Also having the same issue with VisiumHD data (140k + spots/barcodes with over 15k genes).

@giovp Is Squidpy able to work with such granular data? It seems that more and more technologies are going towards that single-cell level resolution on spatial data

Rafael-Silva-Oliveira avatar Apr 14 '24 12:04 Rafael-Silva-Oliveira

Hi @spatts14, @Rafael-Silva-Oliveira,

squidpy should be able to handle data sets of the size you mention. When the kernel crashes, is there any error message? Perhaps this is a RAM issue? Does it also happen if you run it on a machine with more RAM?

LLehner avatar Jun 12 '24 08:06 LLehner

Hi @spatts14, @Rafael-Silva-Oliveira,

squidpy should be able to handle data sets of the size you mention. When the kernel crashes, is there any error message? Perhaps this is a RAM issue? Does it also happen if you run it on a machine with more RAM?

Hei, I'm currently setting up the server with more memory, I will let you know when I give it a try and if it happens again! But it simply crashes, no memory errors in my local machine (32gb RAM, i7)

Rafael-Silva-Oliveira avatar Jun 12 '24 08:06 Rafael-Silva-Oliveira

I think there was an issue with my conda environments. I had to uninstall anaconda and redownload and recreate my environments.

spatts14 avatar Sep 25 '24 19:09 spatts14