r-causal / ggdag

:arrow_lower_left: :arrow_lower_right: An R package for working with causal directed acyclic graphs (DAGs)
https://r-causal.github.io/ggdag/
Other
433 stars 28 forks source link

Error installing package dependencies #124

Closed alex-glynn closed 10 months ago

alex-glynn commented 10 months ago

If I try to install ggdag, I get the following error messages:

ld: library 'emutls_w' not found
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [igraph.so] Error 1
ERROR: compilation failed for package ‘igraph’
* removing ‘/opt/homebrew/lib/R/4.3/site-library/igraph’
ERROR: dependencies ‘igraph’, ‘RcppArmadillo’ are not available for package ‘graphlayouts’
* removing ‘/opt/homebrew/lib/R/4.3/site-library/graphlayouts’
ERROR: dependency ‘igraph’ is not available for package ‘tidygraph’
* removing ‘/opt/homebrew/lib/R/4.3/site-library/tidygraph’
ERROR: dependencies ‘igraph’, ‘tidygraph’, ‘graphlayouts’ are not available for package ‘ggraph’
* removing ‘/opt/homebrew/lib/R/4.3/site-library/ggraph’
ERROR: dependencies ‘ggraph’, ‘igraph’, ‘tidygraph’ are not available for package ‘ggdag’
* removing ‘/opt/homebrew/lib/R/4.3/site-library/ggdag’

Warning messages:
1: In install.packages("ggdag") :
  installation of package ‘RcppArmadillo’ had non-zero exit status
2: In install.packages("ggdag") :
  installation of package ‘igraph’ had non-zero exit status
3: In install.packages("ggdag") :
  installation of package ‘graphlayouts’ had non-zero exit status
4: In install.packages("ggdag") :
  installation of package ‘tidygraph’ had non-zero exit status
5: In install.packages("ggdag") :
  installation of package ‘ggraph’ had non-zero exit status
6: In install.packages("ggdag") :
  installation of package ‘ggdag’ had non-zero exit status

R version 4.3.2 on a MacBook Pro running Sonoma 14.0

malcolmbarrett commented 10 months ago

It seems you are having trouble installing igraph, not ggdag. In particular, you are having trouble compiling it. Have you compiled packages from source before? You may need to install some extra things on mac to run it, e.g. run xcode-select --install in your terminal.

The simple solution here, though, is to try to install from binary, e.g. install.packages("igraph", type = "binary"). igraph can be troublesome to compile even with the right setup so it's better to use the pre-compiled version.

caveat: you seem to be using brew to manage R, and I think there are some peculiarities about that that I forget the details of.

alex-glynn commented 10 months ago

Dear Mr. Barrett,

Thank you for getting back to me so quickly.

As you suspected, Homebrew seems to have been the problem. There’s some speculation on Stack Overflow that it’s an issue specific to newer MacBooks with M chips. I reinstalled R from CRAN, and there was no further issue.

I’m two chapters into Causal Inference in R, by the way. It’s been great so far.

Many thanks, Alex

malcolmbarrett commented 10 months ago

Glad to hear it. We just updated our chapter on DAGs, so a good time to get the package working!