Can't install Matrix

Hi, I've been having issues installing Matrix on R. I never had issues in the past. I ran into issues when my installed version of Seurat updated to v5, which changes the assay type to Assay5. I would have to change a lot of my code to figure out how to work with Assay5 at this point, so I decided to downgrade Seurat to version 4.0.2 which worked perfectly fine before. Someone I work with has that version of Seurat and version 1.3.4 of Matrix, so I decided to install that version to be compatible. I have R version 4.2.3.

I ran this line and received the following error:

remotes::install_version("Matrix", version = "1.3.4", repos = "https://cran.r-project.org")

ld: warning: -single_module is obsolete
ld: warning: -multiply_defined is obsolete
ld: warning: search path '/usr/local/gfortran/lib/gcc/x86_64-apple-darwin18/8.2.0' not found
ld: warning: search path '/usr/local/gfortran/lib' not found
ld: library 'gfortran' not found
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’

  • removing ‘/Library/Frameworks/R.framework/Versions/4.2/Resources/library/Matrix’
    Warning message:
    In i.p(...) :
    installation of package ‘/var/folders/ry/rg1yzt75375_hp0p6qfqqvs00000gn/T//Rtmp9d3IQZ/remotes7f57428bd1cd/Matrix’ had non-zero exit status

I also tried this, resulting in the same error:

packageurl <- "http://cran.r-project.org/src/contrib/Archive/Matrix/Matrix_1.3-4.tar.gz"
install.packages(packageurl, repos=NULL, type="source")

I went to the CRAN repository and downloaded the matrix file onto my computer to try to upload it that way. I have permissions to read and write the file, but I still got the same errors as above.

install.packages("~/Downloads/Matrix_1.3-4.tar", repos = NULL, type = "source")

I would really appreciate any help as it shouldn't be this difficult to install a package that I've had downloaded in the past. Thank you!

The installer is looking for and not finding the gfortran package (GNU Fortran compiler), which is a system package (not an R package). Do you have it installed?

1 Like

Installing it fixed the problem, thank you so much!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.