HealthCatalyst / healthcareai-r

R tools for healthcare machine learning
https://docs.healthcare.ai
Other
246 stars 107 forks source link

install.packages("healthcareai") fails with `fatal error: 'omp.h' file not found` #1234

Open acksmaggart opened 6 years ago

acksmaggart commented 6 years ago

OS: macOS 10.13.16 Machine: MacBook Pro 2.6GHz Intel Core i7 (2017)

When installing healthcareai-r as the first (or at least one of the first) packages to be installed after installing the R executable its self many dependencies are downloaded. The majority of these finish installing without issue, however after ~10 min the following error message is thrown:

ERROR: dependency ‘ModelMetrics’ is not available for package ‘caret’
* removing ‘/usr/local/lib/R/3.5/site-library/caret’
Warning in install.packages :
  installation of package ‘caret’ had non-zero exit status
ERROR: dependency ‘caret’ is not available for package ‘healthcareai’
* removing ‘/usr/local/lib/R/3.5/site-library/healthcareai’
Warning in install.packages :
  installation of package ‘healthcareai’ had non-zero exit status

Trying to explicitly install caret using install.packages("caret") gives this error:

auc_.cpp:2:10: fatal error: 'omp.h' file not found
#include <omp.h>
         ^~~~~~~
1 error generated.
make: *** [auc_.o] Error 1
ERROR: compilation failed for package ‘ModelMetrics’
* removing ‘/usr/local/lib/R/3.5/site-library/ModelMetrics’
Warning in install.packages :
  installation of package ‘ModelMetrics’ had non-zero exit status
ERROR: dependency ‘ModelMetrics’ is not available for package ‘caret’
* removing ‘/usr/local/lib/R/3.5/site-library/caret’
Warning in install.packages :
  installation of package ‘caret’ had non-zero exit status

The issue is resolved by installing libomp. In my case I used brew install libomp. This may be an issue with caret, but I'll put it here for the record.

To recreate:

  1. Uninstall R. e.g. brew uninstall r
  2. Remove all installed packages. e.g. rm -fr /usr/local/lib/R
  3. Remove libomp. e.g. brew uninstall libomp
  4. Reinstall R. e.g. brew install r
  5. Attempt to install healthcareai. i.e. install.packages("healthcareai")
michaellevy commented 6 years ago

@MaxTaggart I wouldn't install R with homebrew. Would you mind installing via the installer and let me know how that goes: https://cran.r-project.org/bin/macosx/