satijalab / seurat

R toolkit for single cell genomics
http://www.satijalab.org/seurat
Other
2.25k stars 904 forks source link

Cannot load SeuratObject due to Matrix #7760

Closed schrodingersmom closed 12 months ago

schrodingersmom commented 1 year ago

remotes::install_github("mojaveazure/seurat-object", "seurat5", quiet = TRUE) Error: Failed to install 'SeuratObject' from GitHub: System command 'R' failed, exit status: 1, stdout + stderr (last 10 lines): E> moving datasets to lazyload DB E> byte-compile and prepare package for lazy loading E> Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : E> namespace ‘Matrix’ 1.4-1 is being loaded, but >= 1.5.0 is required E> Calls: ... namespaceImportFrom -> asNamespace -> loadNamespace E> Execution halted E> ERROR: lazy loading failed for package ‘SeuratObject’ E> removing ‘/private/var/folders/qr/r_ddjnt12cn4kb_q6b81rgdc0000gp/T/RtmpcWJNR2/Rinstca3071becde3/SeuratObject’ E> ----------------------------------- E> ERROR: package installation failed

Getting this error when I 'm trying to download SeuratObj to run the new Seurat for multiomics analysis. I already downloaded Seuratv5 and restarted. Googled everything and went through as many threads here on Github that I can bear, restarted R studio a couple of times. Any ideas? Thanks in advance.

Gesmira commented 1 year ago

Did you try updating Matrix? After restarting R studio, you can run install.packages("Matrix") and that should update it.

schrodingersmom commented 1 year ago

I tried to install.packages, but it said Error in install.packages : Updating loaded packages Restarting R session... and then it gets mad that I don't have SeuratObject, but SeuratObject needs matrix thanks for your response

Gesmira commented 1 year ago

Ok makes sense, you should only update in a fresh R session that has nothing loaded in. So you should clear your environment, then restart R, then run install.packages("Matrix"). Let me know if that helps. If you can provide some more details on errors you're getting if it persists we can try to debug futher.

schrodingersmom commented 1 year ago

Hi, I am still having issues. Loading required package: Matrix

install.packages("Matrix") Error in install.packages : Updating loaded packages

Restarting R session...

library(Seurat) Error: package or namespace load failed for ‘Seurat’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]): there is no package called ‘SeuratObject’ install.packages("Matrix") Error in install.packages : Updating loaded packages

Restarting R session...

It never gets past this and I have restarted Rstudio each time

schrodingersmom commented 1 year ago

Hi- I restarted my computer and R studio and cleared all R.scripts (environment was already cleared per your suggestion), and I keep getting the same error.

library(Seurat) Error: package or namespace load failed for ‘Seurat’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]): there is no package called ‘SeuratObject’ remotes::install_github("mojaveazure/seurat-object", "seurat5", quiet = TRUE) Error: Failed to install 'SeuratObject' from GitHub: System command 'R' failed, exit status: 1, stdout + stderr (last 10 lines): E> moving datasets to lazyload DB E> byte-compile and prepare package for lazy loading E> Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : E> namespace ‘Matrix’ 1.4-1 is being loaded, but >= 1.5.0 is required E> Calls: ... namespaceImportFrom -> asNamespace -> loadNamespace E> Execution halted E> ERROR: lazy loading failed for package ‘SeuratObject’ E> removing ‘/private/var/folders/qr/r_ddjnt12cn4kb_q6b81rgdc0000gp/T/Rtmp92mDqo/Rinstb7f5e53d2d4/SeuratObject’ E> ----------------------------------- E> ERROR: package installation failed

alikhuseynov commented 1 year ago

Hi- I restarted my computer and R studio and cleared all R.scripts (environment was already cleared per your suggestion), and I keep getting the same error.

library(Seurat) Error: package or namespace load failed for ‘Seurat’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]): there is no package called ‘SeuratObject’ remotes::install_github("mojaveazure/seurat-object", "seurat5", quiet = TRUE) Error: Failed to install 'SeuratObject' from GitHub: System command 'R' failed, exit status: 1, stdout + stderr (last 10 lines): E> moving datasets to lazyload DB E> byte-compile and prepare package for lazy loading E> Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) : E> namespace ‘Matrix’ 1.4-1 is being loaded, but >= 1.5.0 is required E> Calls: ... namespaceImportFrom -> asNamespace -> loadNamespace E> Execution halted E> ERROR: lazy loading failed for package ‘SeuratObject’ E> removing ‘/private/var/folders/qr/r_ddjnt12cn4kb_q6b81rgdc0000gp/T/Rtmp92mDqo/Rinstb7f5e53d2d4/SeuratObject’ E> ----------------------------------- E> ERROR: package installation failed

I think it's pretty clear, your Maxtrix package is outdated. Check the Maxtrix package version before you install Seurat v5 and SeuratObject. eg,Biobase::package.version("Matrix") current version is 1.6.1 on CRAN, then install the newest version.

schrodingersmom commented 1 year ago

Hi, I am unable to install the Matrix with install.packages('Matrix'), and have been trying if you read my prior posts. It appears to start trying to install with pages of code and then gives the following error. Given my matrix is 1.4, do I need to update to 1.5 before going to 1.6, I also tried downloading the .tar from CRAN to install from a file on my harddrive, but also does not work. Any help would be great!

clang -mmacosx-version-min=10.13 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -DNTIMER -I/usr/local/include -fPIC -Wall -g -O2 -c SuiteSparse_config.c -o SuiteSparse_config.o ar -rucs ../SuiteSparse_config.a SuiteSparse_config.o clang -mmacosx-version-min=10.13 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o Matrix.so CHMfactor.o Csparse.o init.o Mutils.o bind.o chm_common.o coerce.o cs.o cs_utils.o dense.o dgCMatrix.o dgeMatrix.o factorizations.o kappa.o sparseVector.o abIndex.o packedMatrix.o products.o unpackedMatrix.o sparse.o subscript.o validity.o CHOLMOD.a COLAMD.a AMD.a SuiteSparse_config.a -L/Library/Frameworks/R.framework/Resources/lib -lRlapack -L/Library/Frameworks/R.framework/Resources/lib -lRblas -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin18/8.2.0 -L/usr/local/gfortran/lib -lgfortran -lquadmath -lm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation ld: warning: directory not found for option '-L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin18/8.2.0' ld: warning: directory not found for option '-L/usr/local/gfortran/lib' ld: library not found for -lgfortran clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [Matrix.so] Error 1 ERROR: compilation failed for package ‘Matrix’

The downloaded source packages are in ‘/private/var/folders/qr/r_ddjnt12cn4kb_q6b81rgdc0000gp/T/RtmpPj1f7Q/downloaded_packages’

alikhuseynov commented 1 year ago

You can update Matrix directly to 1.6 version. I think your issue is not related to Seurat or SeuratObject, it's on your Mac side. Probably this will solve your issue -> https://github.com/bioinfoDZ/RISC/issues/10 and https://mac.r-project.org/tools/, basically install Fortran compiler and add to your PATH One can also install it via brew install gcc -> https://formulae.brew.sh/formula/gcc (brew needs to be installed before though -> https://brew.sh/) Hope this helps

saketkc commented 12 months ago

Hi @schrodingersmom , I would recommend starting a new session and doing:

remove.packages("SeuratObject")
remove.packages("Matrix")
# Restart R-session
install.packages("SeuratObject")

Please create a new issue if this does not fix your installation.

apal6 commented 4 months ago

Hi,

This still doesn't work. I tried to remove the packages and install it again but it gives an error saying:

Loading required package: SeuratObject Loading required package: sp Error: package or namespace load failed for ‘SeuratObject’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]): there is no package called ‘Matrix’ Error: package ‘SeuratObject’ could not be loaded

Any suggestions?

Thank you

AlicenJoyHenning commented 4 months ago

Hi @apal6 , I had the same problem and managed to get around it by downloading and installing the source Matrix package from the CRAN website

install.packages("local/path/to/Matrix_1.6-4.tar.gz", repos = NULL, type="source") library("Matrix")

Before installing SeuratObject again with BiocManager

if (!require("BiocManager", quietly = TRUE)) install.packages("BiocManager") BiocManager::install(version = "3.19") library("BiocManager") BiocManager::install("SeuratObject") library("SeuratObject") BiocManager::install("Seurat") library("Seurat")

This only worked for me when I installed a Matrix version greater than 1.6.4, not with any previous versions or the latest version likely because of my version of R (R 4.3.1). Not sure if it'll work for you but maybe it's worth a try?

MorganMeng commented 3 months ago

Thank you very much @AlicenJoyHenning , Matrix_1.6-4. did work for R version 4.2.3 while installing Seurat

Stolfidobranchia commented 4 weeks ago

Same thing is happening to me:

library(Seurat) Loading required package: SeuratObject Loading required package: sp Error: package or namespace load failed for ‘SeuratObject’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]): namespace ‘Matrix’ 1.5-3 is being loaded, but >= 1.6.3 is required Error: package ‘SeuratObject’ could not be loaded