kharchenkolab/leidenAlg

Installation on macOS not successful II

Closed this issue · 6 comments

Hi, I am having issues installing leidenAlg in a conda environment on macOS. The installation is looking for an igraph.so file where only igraph.dylib is available, since I'm on macOS.

I also looked at #5, but all mentioned dependencies are installed within the conda environment.

Can you maybe help out?

Support is much appreciated.

  • Error message:
> install.packages('leidenAlg')

...

Attaching package: ‘igraph’

The following objects are masked from ‘package:stats’:

    decompose, spectrum

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

    union

clang-12: error: no such file or directory: '/.../miniconda3/envs/scib-R/lib/R/library/igraph/libs/igraph.so'
make: *** [/.../miniconda3/envs/scib-R/lib/R/share/make/shlib.mk:6: leidenAlg.dylib] Error 1
ERROR: compilation failed for package ‘leidenAlg’
* removing ‘/.../miniconda3/envs/scib-R/lib/R/library/leidenAlg’
  • SessionInfo. I'm limited to R 3.6 due to another package.
> sessionInfo()
R version 3.6.0 (2019-04-26)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: macOS High Sierra 10.13.6

Matrix products: default
BLAS/LAPACK: /.../miniconda3/envs/scib-R/lib/R/lib/libRblas.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] igraph_1.2.9

Hi @simonmfr

Yeah, it's possible there's another Mac OS update causing issues; I'll have to check. I may add more details for troubleshooting as well in https://github.com/kharchenkolab/leidenAlg/wiki/Installing-leidenAlg-for-Mac-OS

Question: What are the contents of this?
/.../miniconda3/envs/scib-R/lib/R/library/igraph/libs/

Another question: When you run the following, what do you see?

echo 'library(igraph); cat(system.file("libs", package="igraph"))'    | ${R_HOME}/bin/R --vanilla --slave

whereby ${R_HOME}/bin/R points to the version in R you're using. It's from here: https://github.com/kharchenkolab/leidenAlg/blob/main/src/Makevars#L6-L7

Here's what I would recommend trying:
https://github.com/kharchenkolab/leidenAlg/blob/main/src/Makevars#L20-L23

Run the command: install_name_tool -id '@rpath/igraph.so' /.../miniconda3/envs/scib-R/lib/R/library/igraph/libs/igraph.so

Then the installation should work.

Hi @simonmfr

I've tried to provide more details regarding how to fix this issue here in the Wiki: https://github.com/kharchenkolab/leidenAlg/wiki/Installing-leidenAlg-for-Mac-OS#troubleshooting

Let me know if that's helpful. I'm hoping this will be able to help future users.

If this does help, let's close the issue.

Thanks, Evan

@evanbiederstedt Thank you for your quick reply. The problem is that /Users/.../miniconda3/envs/scib-R/lib/R/library/igraph/libs does not contain an igraph.so file, and hence install_name_tool does not work.

$ pwd; ls
/Users/.../miniconda3/envs/scib-R/lib/R/library/igraph/libs
igraph.dylib

I assume this is an issue caused by igraph and not leidenAlg?

The system.file command that you mentioned refers to the same igraph library:

$ echo 'library(igraph); cat(system.file("libs", package="igraph"))'    | ${R_HOME}/bin/R --vanilla --slave

Attaching package: ‘igraph’

The following objects are masked from ‘package:stats’:

    decompose, spectrum

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

    union

/Users/.../miniconda3/envs/scib-R/lib/R/library/igraph/libs

Best,
Simon

Hi @simonmfr

Thanks for your help with this.

Ok, I understand now what is going on. For more information on *.so vs *.dylib, check the following: https://stackoverflow.com/questions/2339679/what-are-the-differences-between-so-and-dylib-on-macos

I'm having difficulty myself replicating your environment with conda, so I'm hoping you can help me out to check that this works.

I have two fixes I'm attempting. Could you possibly try installing these both and paste the output you see here?

(1) Please run this: devtools::install_github('kharchenkolab/leidenAlg', ref = 'test/use_dylib')

(2) Please run this: devtools::install_github('kharchenkolab/leidenAlg', ref = 'feature/revise_Makevars')

Note that I only what to see the final lines of the output (though feel free to email everything you have; it will be a lot). Here's what I'm interested in, the lines directly before * DONE (leidenAlg):

if [ "" != "Windows_NT" ] && [ `uname -s` = 'Darwin' ]; then install_name_tool -id '@rpath/igraph.so' `echo 'library(igraph); cat(system.file("libs", package="igraph"))' | /Library/Frameworks/R.framework/Resources/bin/R --vanilla --slave`/igraph.so; fi 

Attaching package: ‘igraph’

The following objects are masked from ‘package:stats’:

    decompose, spectrum

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

    union

installing to /Library/Frameworks/R.framework/Versions/4.1/Resources/library/00LOCK-leidenAlg/00new/leidenAlg/libs
** R
** data
*** moving datasets to lazyload DB
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** testing if installed package can be loaded from temporary location
** checking absolute paths in shared objects and dynamic libraries
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (leidenAlg)

As I say, feel free to paste this output here or email me. I think we'll have a fix up shortly.

I appreciate the help. Best, Evan

Another thing that could help me, @simonmfr

/Users/.../miniconda3/envs/scib-R/lib/R/library/igraph/libs

I don't use conda; if you could specify how to download the miniconda3 environment on a Mac to replicate your setup, I could also check this. I'm curious why *.dylib is used here...

Hi @simonmfr

I was able to replicate your environment following the instructions here for scib-R: https://github.com/theislab/scib-pipeline

The fix now on main works for me. I'll push to CRAN and re-version.

Thanks for bring this to my attention

Best, Evan