WGCNA on my M1 MacBook 2020

I installed R R-4.1.1-arm64.pkg and R studio for MAC 2021.09+351|196.25MB for my M1 Mac 2020. I can't install WGCNA. I tried many things. Could you help me?

Can you please be more specific, What exactly are the things you have tried and what are the error messages you get?

Hi,
When I'm trying library (WGCNA)
I got this error

Loading required package: dynamicTreeCut
Loading required package: fastcluster

Attaching package: ‘fastcluster’

The following object is masked from ‘package:stats’:

    hclust


Error: package or namespace load failed for ‘WGCNA’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
 there is no package called ‘impute’

and before to get that I tried all this

install.packages("BiocManager")
BiocManager::install("WGCNA")
install.packages(c("matrixStats", "Hmisc", "splines", "foreach", "doParallel", "fastcluster", "dynamicTreeCut", "survival"))
biocLite(c("GO.db", "preprocessCore", "impute"))
install.packages("dynamicTreeCut")
install.packages("fastcluster")
packageDescription("WGCNA")[c("Depends", "Imports")]
    "Depends"
   "R (>= 3.0), dynamicTreeCut (>= 1.62), fastcluster"

  "Imports"
  "stats, grDevices, utils, matrixStats (>= 0.8.1), Hmisc,\nimpute, splines, foreach, doParallel, preprocessCore, survival,\nparallel, GO.db, AnnotationDbi"
  BiocManager::install("Biobase")
  BiocManager::install("GO.db")
  install.packages("GO.db")
  BiocManager::valid()
  install.packages("RSQLite")
  library(RSQLite)
  install.packages("BiocManager")
  library(BiocManager)
  BiocManager::install("WGCNA")
  install.packages("WGCNA")
  library(WGCNA)
  source(....I modified because I can't up more than two links in this foro) 
  biocLite("impute")
  install.packages("GO.db")
  install.packages("BiocManager")
  BiocManager::install("WGCNA")
  
  install.packages(c("matrixStats", "Hmisc", "splines", "foreach", "doParallel", "fastcluster", "dynamicTreeCut", "survival"))
  source("https://bioconductor.org/install")
  source("https://bioconductor.org/biocLite.R")
if (!requireNamespace("BiocManager", quietly = TRUE))
    install.packages("BiocManager")
  
  BiocManager::install("GO.db")

  if (!requireNamespace("BiocManager", quietly = TRUE))
    
  
  BiocManager::install("impute")
  if (!requireNamespace("BiocManager", quietly = TRUE))
    install.packages("BiocManager")
  
  BiocManager::install("AnnotationDbi")
  library(WGCNA)
  BiocInstaller::biocLite(c("GenomicFeatures", "AnnotationDbi"))
  BiocInstaller::biocLite(c("GO.db", "preprocessCore", "impute"))
  library(WGCNA)

This is telling you that you are missing a package dependency, try installing it first

BiocManager::install("impute")

Thank you, I tried and I have this error

   BiocManager::install("impute")
'getOption("repos")' replaces Bioconductor standard repositories, see '?repositories' for details

replacement repositories:
    CRAN: https://cran.rstudio.com/

Bioconductor version 3.13 (BiocManager 1.30.16), R 4.1.1 (2021-08-10)
Installing package(s) 'impute'
Package which is only available in source form, and may need compilation of C/C++/Fortran: ‘impute’
Do you want to attempt to install these from sources? (Yes/no/cancel) yes
installing the source package ‘impute’

trying URL 'https://bioconductor.org/packages/3.13/bioc/src/contrib/impute_1.66.0.tar.gz'
Content type 'application/x-gzip' length 641577 bytes (626 KB)
==================================================
downloaded 626 KB

* installing *source* package ‘impute’ ...
** using staged installation
** libs
/opt/R/arm64/bin/gfortran -mtune=native -fno-optimize-sibling-calls  -fPIC  -Wall -g -O2  -c knnimpute.f -o knnimpute.o
make: /opt/R/arm64/bin/gfortran: No such file or directory
make: *** [knnimpute.o] Error 1
ERROR: compilation failed for package ‘impute’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/impute’

The downloaded source packages are in
	‘/private/var/folders/1_/2bnzfmdx0n334rcq5q100jxr0000gn/T/RtmpGqEHCw/downloaded_packages’
Old packages: 'Hmisc', 'mgcv'
Update all/some/none? [a/s/n]: 
a
Warning: unable to access index for repository https://bioconductor.org/packages/3.13/bioc/bin/macosx/big-sur-arm64/contrib/4.1:
  cannot open URL 'https://bioconductor.org/packages/3.13/bioc/bin/macosx/big-sur-arm64/contrib/4.1/PACKAGES'
Warning: unable to access index for repository https://bioconductor.org/packages/3.13/data/annotation/bin/macosx/big-sur-arm64/contrib/4.1:
  cannot open URL 'https://bioconductor.org/packages/3.13/data/annotation/bin/macosx/big-sur-arm64/contrib/4.1/PACKAGES'
Warning: unable to access index for repository https://bioconductor.org/packages/3.13/data/experiment/bin/macosx/big-sur-arm64/contrib/4.1:
  cannot open URL 'https://bioconductor.org/packages/3.13/data/experiment/bin/macosx/big-sur-arm64/contrib/4.1/PACKAGES'
Warning: unable to access index for repository https://bioconductor.org/packages/3.13/workflows/bin/macosx/big-sur-arm64/contrib/4.1:
  cannot open URL 'https://bioconductor.org/packages/3.13/workflows/bin/macosx/big-sur-arm64/contrib/4.1/PACKAGES'
Warning: unable to access index for repository https://bioconductor.org/packages/3.13/books/bin/macosx/big-sur-arm64/contrib/4.1:
  cannot open URL 'https://bioconductor.org/packages/3.13/books/bin/macosx/big-sur-arm64/contrib/4.1/PACKAGES'

  There are binary versions available but the source versions are later:
      binary source needs_compilation
Hmisc  4.5-0  4.6-0              TRUE
mgcv  1.8-37 1.8-38              TRUE

Do you want to install from sources the packages which need compilation? (Yes/no/cancel) yes
installing the source packages ‘Hmisc’, ‘mgcv’

trying URL 'https://cran.rstudio.com/src/contrib/Hmisc_4.6-0.tar.gz'
Content type 'application/x-gzip' length 784633 bytes (766 KB)
==================================================
downloaded 766 KB

trying URL 'https://cran.rstudio.com/src/contrib/mgcv_1.8-38.tar.gz'
Content type 'application/x-gzip' length 1207405 bytes (1.2 MB)
==================================================
downloaded 1.2 MB

* installing *source* package ‘Hmisc’ ...
** package ‘Hmisc’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/opt/R/arm64/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c Hmisc.c -o Hmisc.o
/opt/R/arm64/bin/gfortran -mtune=native -fno-optimize-sibling-calls  -fPIC  -Wall -g -O2  -c cidxcn.f -o cidxcn.o
make: /opt/R/arm64/bin/gfortran: No such file or directory
make: *** [cidxcn.o] Error 1
ERROR: compilation failed for package ‘Hmisc’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/Hmisc’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/Hmisc’
* installing *source* package ‘mgcv’ ...
** package ‘mgcv’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/opt/R/arm64/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c coxph.c -o coxph.o
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/opt/R/arm64/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c davies.c -o davies.o
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/opt/R/arm64/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c discrete.c -o discrete.o
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/opt/R/arm64/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c gdi.c -o gdi.o
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/opt/R/arm64/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c init.c -o init.o
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/opt/R/arm64/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c magic.c -o magic.o
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/opt/R/arm64/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c mat.c -o mat.o
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/opt/R/arm64/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c matrix.c -o matrix.o
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/opt/R/arm64/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c mgcv.c -o mgcv.o
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/opt/R/arm64/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c misc.c -o misc.o
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/opt/R/arm64/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c mvn.c -o mvn.o
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/opt/R/arm64/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c qp.c -o qp.o
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/opt/R/arm64/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c soap.c -o soap.o
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/opt/R/arm64/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c sparse-smooth.c -o sparse-smooth.o
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/opt/R/arm64/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c sparse.c -o sparse.o
clang -arch arm64 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG   -I/opt/R/arm64/include   -fPIC  -falign-functions=64 -Wall -g -O2  -c tprs.c -o tprs.o
clang -arch arm64 -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/opt/R/arm64/lib -o mgcv.so coxph.o davies.o discrete.o gdi.o init.o magic.o mat.o matrix.o mgcv.o misc.o mvn.o qp.o soap.o sparse-smooth.o sparse.o tprs.o -L/Library/Frameworks/R.framework/Resources/lib -lRlapack -L/Library/Frameworks/R.framework/Resources/lib -lRblas -L/opt/R/arm64/gfortran/lib/gcc/aarch64-apple-darwin20.2.0/11.0.0 -L/opt/R/arm64/gfortran/lib -lgfortran -lemutls_w -lm -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
ld: warning: directory not found for option '-L/opt/R/arm64/gfortran/lib/gcc/aarch64-apple-darwin20.2.0/11.0.0'
ld: warning: directory not found for option '-L/opt/R/arm64/gfortran/lib'
ld: library not found for -lgfortran
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [mgcv.so] Error 1
ERROR: compilation failed for package ‘mgcv’
* removing ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/mgcv’
* restoring previous ‘/Library/Frameworks/R.framework/Versions/4.1-arm64/Resources/library/mgcv’

The downloaded source packages are in
	‘/private/var/folders/1_/2bnzfmdx0n334rcq5q100jxr0000gn/T/RtmpGqEHCw/downloaded_packages’
Warning messages:
1: In .inet_warning(msg) :
  unable to access index for repository https://bioconductor.org/packages/3.13/bioc/bin/macosx/big-sur-arm64/contrib/4.1:
  cannot open URL 'https://bioconductor.org/packages/3.13/bioc/bin/macosx/big-sur-arm64/contrib/4.1/PACKAGES'
2: In .inet_warning(msg) :
  unable to access index for repository https://bioconductor.org/packages/3.13/data/annotation/bin/macosx/big-sur-arm64/contrib/4.1:
  cannot open URL 'https://bioconductor.org/packages/3.13/data/annotation/bin/macosx/big-sur-arm64/contrib/4.1/PACKAGES'
3: In .inet_warning(msg) :
  unable to access index for repository https://bioconductor.org/packages/3.13/data/experiment/bin/macosx/big-sur-arm64/contrib/4.1:
  cannot open URL 'https://bioconductor.org/packages/3.13/data/experiment/bin/macosx/big-sur-arm64/contrib/4.1/PACKAGES'
4: In .inet_warning(msg) :
  unable to access index for repository https://bioconductor.org/packages/3.13/workflows/bin/macosx/big-sur-arm64/contrib/4.1:
  cannot open URL 'https://bioconductor.org/packages/3.13/workflows/bin/macosx/big-sur-arm64/contrib/4.1/PACKAGES'
5: In .inet_warning(msg) :
  unable to access index for repository https://bioconductor.org/packages/3.13/books/bin/macosx/big-sur-arm64/contrib/4.1:
  cannot open URL 'https://bioconductor.org/packages/3.13/books/bin/macosx/big-sur-arm64/contrib/4.1/PACKAGES'
6: In .inet_warning(msg) :
  installation of package ‘impute’ had non-zero exit status
7: In install.packages(update[instlib == l, "Package"], l, repos = repos,  :
  installation of package ‘Hmisc’ had non-zero exit status
8: In install.packages(update[instlib == l, "Package"], l, repos = repos,  :
  installation of package ‘mgcv’ had non-zero exit status
> library(WGCNA)
Error: package or namespace load failed for ‘WGCNA’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
 there is no package called ‘impute’
> #Read in the gene expression data set
> transdata = read.csv("CCLE_RNAseq_transcripts60L.C.conNombreRealdeL.C.deB.C.txt", sep ="\t")
> library(WGCNA)
Error: package or namespace load failed for ‘WGCNA’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
 there is no package called ‘impute’

Your computer is missing the Fortran compiler needed to install packages from source, unfortunately I'm not a Mac M1 user so I can't give you any specific advice but I found this SO post that I think should solve your problem

Thank you for your help andresrcs. I'm going to try :slight_smile:

This topic was automatically closed 21 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.