Error while installing a R package

Hi,

I am trying to install a R package "Signac" in R Studio, but it always shows an below error and unsuccessful. Please let me know how to resolve this error?

Package

install.packages("Signac")

Error

Installing package into ‘/Users/toufim/Library/R/x86_64/4.2/library’
(as ‘lib’ is unspecified)

There is a binary version available but the source version is later:
  binary source needs_compilation
Signac 1.11.0 1.12.0              TRUE
Do you want to install from sources the package which needs compilation? (Yes/no/cancel) Yes

installing the source package ‘Signac’

trying URL 'https://cran.rstudio.com/src/contrib/Signac_1.12.0.tar.gz'
Content type 'application/x-gzip' length 822861 bytes (803 KB)
==================================================
  downloaded 803 KB

* installing *source* package ‘Signac’ ...
** package ‘Signac’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang++ -mmacosx-version-min=10.13 -std=gnu++14 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Users/toufim/Library/R/x86_64/4.2/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c RcppExports.cpp -o RcppExports.o
clang++ -mmacosx-version-min=10.13 -std=gnu++14 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Users/toufim/Library/R/x86_64/4.2/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c filter.cpp -o filter.o
clang++ -mmacosx-version-min=10.13 -std=gnu++14 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Users/toufim/Library/R/x86_64/4.2/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c group.cpp -o group.o
clang++ -mmacosx-version-min=10.13 -std=gnu++14 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Users/toufim/Library/R/x86_64/4.2/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c split.cpp -o split.o
clang++ -mmacosx-version-min=10.13 -std=gnu++14 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Users/toufim/Library/R/x86_64/4.2/library/Rcpp/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c validate.cpp -o validate.o
clang++ -mmacosx-version-min=10.13 -std=gnu++14 -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 Signac.so RcppExports.o filter.o group.o split.o validate.o -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
installing to /Users/toufim/Library/R/x86_64/4.2/library/00LOCK-Signac/00new/Signac/libs
** R
** data
*** moving datasets to lazyload DB
** inst
** byte-compile and prepare package for lazy loading
Error: object ‘LayerData<-’ is not exported by 'namespace:SeuratObject'
Execution halted
ERROR: lazy loading failed for package ‘Signac’
* removing ‘/Users/toufim/Library/R/x86_64/4.2/library/Signac’
Warning in install.packages :
  installation of package ‘Signac’ had non-zero exit status

The downloaded source packages are in
‘/private/var/folders/vb/wx7j_lbd5d7bqp3mnh3_zf45dglmy5/T/RtmpqJB1IL/downloaded_packages’
Warning message:
  In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE,  :
               there is no package called ‘Signac’

sessionInfo()

> sessionInfo()
R version 4.2.1 (2022-06-23)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS Ventura 13.4.1

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.2/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] SeuratObject_4.1.3 Seurat_4.3.0.1     edgeR_3.40.0       limma_3.54.2      

loaded via a namespace (and not attached):
  [1] plyr_1.8.7                igraph_1.5.0.1            lazyeval_0.2.2            sp_2.1-2                 
  [5] splines_4.2.1             BiocParallel_1.32.0       listenv_0.9.0             scattermore_1.2          
  [9] usethis_2.1.6             ggplot2_3.4.4             digest_0.6.33             htmltools_0.5.4 

Thank you,
Toufiq

Seems like this version of Signac is not compatible with the version of the SeuratObject package that you have installed.

Can you try installing the older, binary version instead of compiling from source? You can also try updating the SeuratObject package.

Ultimately, this is a problem with the Signac package, so you can also try reporting an issue for that package.

Thank you @Gabor. I also tried installing the older version but still no success: Installation • Signac, I will report this.

Additionally, I encountered another issue with installing another package harmony but got a different error (please see below). Do you how I can resolve this error?

> install.packages("harmony")
Installing package into ‘/Users/toufim/Library/R/x86_64/4.2/library’
(as ‘lib’ is unspecified)

There is a binary version available but the source version is later:
  binary source needs_compilation
harmony  1.0.3  1.2.0              TRUE

Do you want to install from sources the package which needs compilation? (Yes/no/cancel) Yes
installing the source package ‘harmony’

trying URL 'https://cran.rstudio.com/src/contrib/harmony_1.2.0.tar.gz'
Content type 'application/x-gzip' length 5179505 bytes (4.9 MB)
==================================================
  downloaded 4.9 MB

* installing *source* package ‘harmony’ ...
** package ‘harmony’ successfully unpacked and MD5 sums checked
** using staged installation
** libs
clang++ -mmacosx-version-min=10.13 -std=gnu++14 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Users/toufim/Library/R/x86_64/4.2/library/Rcpp/include' -I'/Users/toufim/Library/R/x86_64/4.2/library/RcppArmadillo/include' -I'/Users/toufim/Library/R/x86_64/4.2/library/RcppProgress/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c RcppExports.cpp -o RcppExports.o
clang++ -mmacosx-version-min=10.13 -std=gnu++14 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Users/toufim/Library/R/x86_64/4.2/library/Rcpp/include' -I'/Users/toufim/Library/R/x86_64/4.2/library/RcppArmadillo/include' -I'/Users/toufim/Library/R/x86_64/4.2/library/RcppProgress/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c harmony.cpp -o harmony.o
clang++ -mmacosx-version-min=10.13 -std=gnu++14 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Users/toufim/Library/R/x86_64/4.2/library/Rcpp/include' -I'/Users/toufim/Library/R/x86_64/4.2/library/RcppArmadillo/include' -I'/Users/toufim/Library/R/x86_64/4.2/library/RcppProgress/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c timer.cpp -o timer.o
clang++ -mmacosx-version-min=10.13 -std=gnu++14 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG  -I'/Users/toufim/Library/R/x86_64/4.2/library/Rcpp/include' -I'/Users/toufim/Library/R/x86_64/4.2/library/RcppArmadillo/include' -I'/Users/toufim/Library/R/x86_64/4.2/library/RcppProgress/include' -I/usr/local/include   -fPIC  -Wall -g -O2  -c utils.cpp -o utils.o
clang++ -mmacosx-version-min=10.13 -std=gnu++14 -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 harmony.so RcppExports.o harmony.o timer.o utils.o -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: *** [harmony.so] Error 1
ERROR: compilation failed for package ‘harmony’
* removing ‘/Users/toufim/Library/R/x86_64/4.2/library/harmony’
Warning in install.packages :
  installation of package ‘harmony’ had non-zero exit status

The downloaded source packages are in
‘/private/var/folders/vb/wx7j_lbd5d7bqp3mnh3_zf45dglmy5/T/Rtmpn8XPaq/downloaded_packages’

Is the fortran compiler installed? If not, see Tools - R for Mac OS X - developer's page - GNU Fortan for Xcode .

@EconProf thank you. I just installed fortran from the link you provided. Then tried installing the same harmony R package but still getting the same error as above.

I checked CRAN and there is no binary of the harmony package for R 4.2 on a x86_64 (Intel) mac. It's not just that the binary is for an older version of harmony (1.0.3 instead of 1.2.0), but there is no binary at all. Strange! There are up-to-date binaries for R 4.3, the current release version.

I also recall adding /opt/gfortran/bin to the PATH to get the fortran compiler working properly, but do not know if this is still necessary (or exactly how I did it). Hopefully someone with more knowledge can clear that up.

1 Like

There is definitely an older binary for harmony, it is here: https://cran.rstudio.com/bin/macosx/contrib/4.2/
https://cran.rstudio.com/bin/macosx/contrib/4.2/harmony_1.0.3.tgz

There are a couple of things you could do. One is using R 4.3.x, which has binaries for the latest package versions, so you don't need to compile packages.

Alternatively, I suggest you try using pak (see All about installing pak. — Installing pak • pak for installation). pak will automatically select the binary packages, unless the newer ones are explicitly needed.

Or, you can use install.packages() (interactively), but choose the older binary package for installation, instead of trying to compile packages from source.

Lastly, you could try setting up your system, so that it is able to compile packages, but honestly, I would only do this if the other solutions are not appropriate.

1 Like

@EconProf thank you for the advise and suggestion. I re-installed with R for my Mac: Apple silicon (M1/M2) Macs: R-4.3.2-arm64.pkg, this fixed the issue with downloading packages.

@Gabor thank you for the advise and suggestion. I re-installed with R for my Mac: Apple silicon (M1/M2) Macs: R-4.3.2-arm64.pkg, this fixed the issue with downloading packages.

Sorry for the confusion about binaries on CRAN. I had not noticed that the page for a package no longer shows r-oldrel binaries for x86_64 , just for arm64. Is that recent?

@EconProf I downloaded R from here: R for macOS

Exactly the right place to get R from!

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