Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solution for errors related to as_cholmod_sparse or CRsparse_rowSums #1596

Open
timoast opened this issue Jan 18, 2024 · 8 comments
Open

Solution for errors related to as_cholmod_sparse or CRsparse_rowSums #1596

timoast opened this issue Jan 18, 2024 · 8 comments

Comments

@timoast
Copy link
Collaborator

timoast commented Jan 18, 2024

Following a recent update to the Matrix package, several users have reported errors related to functions that use methods from the Matrix package. These will typically result in error messages like: 'as_cholmod_sparse' not provided by package 'Matrix' or object 'CRsparse_colSums' not found.

Here is a list of relevant issues:

#1559
#1591
#1528
#1530
#1532
#1547

Cause

This is caused by a new version of Matrix removing certain S4 classes. Packages that used certain S4 methods from Matrix (such as irlba, TFBSTools, and Seurat) subsequently encounter errors. This is because the S4 methods are cached when the R package is built, rather than loaded in the R session. The solution is to re-build the impacted packages from source with the updated Matrix package installed. More information can be found here

Solutions

'as_cholmod_sparse' not provided by package 'Matrix'

To resolve this issue re-install the irlba package from source:

install.packages("irlba", type="source")

object 'CRsparse_colSums' not found

To resolve this issue re-install the TFBSTools package as described in this Seurat issue: satijalab/seurat#8202

BiocManager::install("TFBSTools", type = "source", force = TRUE)
@timoast timoast changed the title Solution for errors related to as_cholmod_sparse or CRsparse_rowSums; Solution for errors related to as_cholmod_sparse or CRsparse_rowSums Jan 18, 2024
@timoast timoast pinned this issue Jan 18, 2024
@realmungmung
Copy link

I installed irlba as suggested but still got the error:
Error in irlba(A = t(x = object), nv = n, work = irlba.work, tol = tol) :
function 'as_cholmod_sparse' not provided by package 'Matrix'

@timoast
Copy link
Collaborator Author

timoast commented Jan 22, 2024

@realmungmung from your other issue you posted:

after installation in R, it also showed in the R console:
1: In install.packages("SeuratObject", type = "source") :
installation of packageMatrixhad non-zero exit status
2: In install.packages("SeuratObject", type = "source") :
installation of packageSeuratObjecthad non-zero exit status
In install.packages("irlba", type = "source") :
installation of packageirlbahad non-zero exit status

So these packages are not actually installed. You need to successfully install the packages from source.

@bhanco
Copy link

bhanco commented May 13, 2024

Any tips for how to fix this if you are loading R studio in an interactive session on quest. From a conda environment? I can't run the install.packages commands with a conda built environment.

@JHCCoder
Copy link

@bhanco Have you downloaded R-base in your conda environment? If so you should be able to use install.packages after you start your R environment by entering R in your command line.

@bhanco
Copy link

bhanco commented May 17, 2024

@JHCCoder Wow it wouldn't work when I ran in rstudio but when I ran it from command line it fixed and now I can run through in rstudio. Thanks so much!

@JamesGallant
Copy link

JamesGallant commented Jun 18, 2024

Hi,

I've been having issues with this as well, specifically runChromVar and have tried the solutions already presented. Everything else runs fine and the issue also persists when following the motif tutorial on Signac using the PBMCs.

I get the object 'Error in .local(x, na.rm, dims, ...): object 'CRsparse_colSums' not found error on runChromVar and I have tried the following

  • Installing TFBSTools from source
  • Installing Bioconductior: BiocManager::install(version = "3.18")
  • downgrading matrix -> breaks signac
  • upgrading matrix -> error still persists

Checking colSums like this works, I dont recieve a error but once I runChromVar I see the error again. Found here: satijalab/seurat#8202 (comment)

library(Matrix)

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

R version is 4.3.3
Bioconductor version 3.18
Matrix version: 1.6.5
TFBSTools version 1.40.0
Signac: 1.13.0
Seurat: 5.1.0

Any help will be great, or a alternative methd to visualise motif accessibility would work as well.

Thanks

@timoast
Copy link
Collaborator Author

timoast commented Jun 19, 2024

@JamesGallant Try updating Matrix, then re-installing TFBSTools from source using the command above, then restart R

@JamesGallant
Copy link

@timoast Thanks your suggestion helped me to get it working. I realised that TBFSTtools was not installing properly and needed to run Rstudio in administrator mode on windows.

P.S. for others: This worked for me for version 4.3.3 but not in the latest R version and matrix version. Installing TBFSTtools in version 4.4 of R with matrix at 1.7 will cause errors. R version 4.3.3 and matrix version 1.6.5 works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants