seurat icon indicating copy to clipboard operation
seurat copied to clipboard

Solution: `object 'CRsparse_colSums' not found` raised after upgrading to `Seurat` v5.0.1

Open dcollins15 opened this issue 6 months ago • 4 comments

After upgrading to Seurat/SeuratObject v5.0.1 users who also have Azimuth and/or Signac installed may encounter the following error: object 'CRsparse_colSums' not found when trying to run colSums or rowSums on any dgCMatrix. This in turn breaks quite a bit of Seurat's basic functionality.

To resolve the issue, re-install the TFBSTools package from source and then open a fresh R session:

BiocManager::install("TFBSTools", type = "source", force = TRUE)

If you're able to run the following snippet without raising errors, then the problem has been fixed:

library(Matrix)

colSums(m)
TFBSTools::colSums(m)
colSums(m)

The issue was not triggered by any changes to Azimuth or Seurat directly — rather it is caused by upgrading the Matrix package beyond v1.6-1.1 while the TFBSTools package is already installed. Since Azimuth and Signac both depend on TFBSTools, and SeuratObject v5.0.1 requires Matrix to be at least v1.6-3, upgrading to Seurat/SeuratObject v5.0.1 with either package installed triggers the issue.

The underlying problem appears to be related to S4 method caching for the TFBSTools package. In the case that users installed the package before upgrading Matrix to v1.6-3 the method lookup for dgCMatrix gets resolved to include CRsparse_colSums somewhere along its call stack. Since R caches these lookups at compilation time, the method lookup cached for TFBSTools does not change when Matrix is updated and ends up with a bad reference to a nonexistent function (CRsparse_colSums). Re-installing TFBSTools from source forces the package to recompile and the S4 method caches to update, resolving the issue.

dcollins15 avatar Dec 18 '23 21:12 dcollins15