Get errors in loading packages/ calling functions in sc-seq data analysis
2
0
Entering edit mode
6 months ago
yujunfhf ▴ 40

Hi,

I am learning to process sc-seq data in Rstudio. There are 2 problems I have:

I tried to install scater package using BiocManager::install("scater") but it failed. This is the error message:

ld: warning: directory not found for option '-L/opt/gfortran/lib/gcc/aarch64-apple-darwin20.0/12.2.0'
ld: warning: directory not found for option '-L/opt/gfortran/lib'
ld: library not found for -lgfortran 
clang: error: linker command failed with exit code 1 (use -v to see invocation)

when I install sctransform, it worked. But I cannot use SCTransform(). It keeps warning that:

Error in SCTransform(cells, method = "glmGamPoi", vars.to.regress = "percent.mt",  :
  could not find function "SCTransform"

This is my sessionInfo():

R version 4.3.1 (2023-06-16)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Ventura 13.0

And this is some other information that may be related to this issue:

** libs
using C compiler: ‘Apple clang version 14.0.3 (clang-1403.0.22.14.1)’
using C++ compiler: ‘Apple clang version 14.0.3 (clang-1403.0.22.14.1)’
using SDK: ‘MacOSX13.3.sdk’

Is this related to my mac version?

Thank you!

R scater macos sctransform • 1.2k views
ADD COMMENT
0
Entering edit mode

For the second problem, did you load the SCTransform library before trying to run the function?

library("sctransform")

Your first problem might be relate to this issue on SO. Try seeing if any of those solutions work.

ADD REPLY
0
Entering edit mode

Yes, I load it before running function.

ADD REPLY
4
Entering edit mode
6 months ago
yujunfhf ▴ 40

I think I have found the solutions: 1) my pc is using mac M2 chip, and ARM version Rstudio(for M2 user). This issue can be solve by using this package: GNU Fortran compiler. I found this from Rstudio website:

If you wish to compile R packages which contain Fortran code, you may need to download the corresponding GNU Fortran compiler from https://mac.R-project.org/tools. Any external libraries and tools are expected to live in /opt/R/arm64 (Apple silicon) or /opt/R/x86_64 (Intel).

When I install this compiler, it works now! scater package runs normally,

2) for this issue, I found I must use Seurat::SCTransform() instead of just using SCTransform() I am not sure why.... But it works when I add the namespace Seurat:: before it.

Thanks for your suggestions!

ADD COMMENT
0
Entering edit mode
6 months ago
Ram 43k

Do not use the ARM version of R on the M1/M2 Mac. Use the regular Intel version and let Rosetta do its thing. You'll run into a LOT of these bugs when you use the ARM version.

ADD COMMENT
0
Entering edit mode

Thanks for your suggestion! I have updated my question, It works now.

ADD REPLY
1
Entering edit mode

Thank you for following up and providing a solution!

ADD REPLY

Login before adding your answer.

Traffic: 2181 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6