guiblanchet / HMSC

Hierarchical modelling of species community
40 stars 13 forks source link

Installing HMSC #1

Closed Breckie closed 7 years ago

Breckie commented 7 years ago

Hello, I am having trouble installing HMSC through Rstudio (Version 1.0.136).

Initially, just using install.packages(), I receive the error "Warning in install.packages : package ‘HMSC’ is not available (for R version 3.3.2)".

My standard workaround for this, is to install directly from github, which is how I found your repository:

library(devtools) install_github("guiblanchet/HMSC")

This installs for quite a while, but ends with the error:

"ld: warning: directory not found for option '-L/usr/local/lib/gcc/x86_64-apple-darwin13.0.0/4.8.2' ld: library not found for -lgfortran clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [HMSC.so] Error 1 ERROR: compilation failed for package ‘HMSC’

When looking into this error, I also tried installing "Rcpp" and "RcppArmadillo" before installing via "guiblanchet/HMSC", with the same result.

Then I found this article http://thecoatlessprofessor.com/programming/rcpp-rcpparmadillo-and-os-x-mavericks-lgfortran-and-lquadmath-error/ which seemed promising, but neither running

curl -O http://r.research.att.com/libs/gfortran-4.8.2-darwin13.tar.bz2 sudo tar fvxz gfortran-4.8.2-darwin13.tar.bz2 -C /

...through Terminal, nor following this help comment:

"Could you close out all R sessions (including RStudio), open Terminal and type: xcode-select --install This ensures that you have development command line tools (e. g. gcc, git, et cetera) on your system. Please run: git --version To make sure the license agreements have been approved. From there, I'd like you to try to install the gfortran binaries by again repeating: curl -O http://r.research.att.com/l... sudo tar fvxz gfortran-4.8.2-darwin13.tar.bz2 -C /

...got me any closer. I apologize for bothering you with such a mundane issue, but I believe I have a great data set to use with this package and I am excited to try it out. Thanks!

guiblanchet commented 7 years ago

Sorry it took me so long to answer you, I have been trying to solve the problem you presented here.

From your message, I gather that you are working under Mac OS X and that your problem is mainly a compiler problem related to Rcpp and RcppArmadillo.

I put up a readme on GitHub file that, hopefully, will be helpful for you and allow you to install the HMSC package.

Breckie commented 7 years ago

Thanks, the readme and Rcpp FAQ document were helpful. I think I am getting closer but still not quite there. Rcpp and RcppArmadillo appear to be working fine. I think now the problem lies in trying to get R to be able to locate gfortran. I am going to spend a little more time exploring this path:

http://stackoverflow.com/questions/29992066/rcpp-warning-directory-not-found-for-option-l-usr-local-cellar-gfortran-4-8/29993906#29993906

I will let you know when I come up with a solution!

Breckie commented 7 years ago

I don't exactly how, or why, but on my third try, this worked!

curl -O http://r.research.att.com/libs/gfortran-4.8.2-darwin13.tar.bz2 sudo tar fvxz gfortran-4.8.2-darwin13.tar.bz2 -C /

-run the above text through Terminal, when prompted, enter your password -restart R -and then try and install HMSC

library(devtools) install_github("guiblanchet/HMSC") library(HMSC)

via: https://github.com/Homebrew/legacy-homebrew/issues/43290 (I ignored the part where someone commented "please do not install the r.research.att.com compilers.", and am going to run with it for now!)