harmony icon indicating copy to clipboard operation
harmony copied to clipboard

Error in Installing Harmony in Rstudio

Open aimer-entropy opened this issue 4 years ago • 9 comments

Hello, I'm trying to install harmony through these two ways: library(devtools) install_github("immunogenomics/harmony") install_local('mypathway/harmony-master.zip') While all these two way to install this package failed. I'm using Rstuidio 4.0.2 on maxOS Catalina Version 10.15.

Here's the information when I failed to install.

  • installing source package ‘harmony’ ... ** using staged installation ** libs clang++ -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include' -I'/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppProgress/include' -I/usr/local/include -fPIC -Wall -g -O2 -c RcppExports.cpp -o RcppExports.o In file included from RcppExports.cpp:4: In file included from ./harmony_types.h:1: In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include/RcppArmadillo.h:31: In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include/RcppArmadilloForward.h:49: In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include/armadillo:21: /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include/armadillo_bits/compiler_check.hpp:50:4: error: "*** C++11 compiler required; enable C++11 mode in your compiler, or use an earlier version of Armadillo" #error "*** C++11 compiler required; enable C++11 mode in your compiler, or use an earlier version of Armadillo" ^ In file included from RcppExports.cpp:4: In file included from ./harmony_types.h:1: In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include/RcppArmadillo.h:31: In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include/RcppArmadilloForward.h:49: In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include/armadillo:85: /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include/armadillo_bits/arma_forward.hpp:149:12: error: unknown type name 'constexpr' static constexpr bool is_row = false; ^ /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include/armadillo_bits/arma_forward.hpp:149:22: error: expected member name or ';' after declaration specifiers static constexpr bool is_row = false;

/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include/armadillo_bits/arma_forward.hpp:150:12: error: unknown type name 'constexpr' static constexpr bool is_col = false; ^ /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include/armadillo_bits/arma_forward.hpp:150:22: error: expected member name or ';' after declaration specifiers static constexpr bool is_col = false; ~~~~~~~~~~~~~~~~ ^ /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include/armadillo_bits/arma_forward.hpp:151:12: error: unknown type name 'constexpr' static constexpr bool is_xvec = false; ^ /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include/armadillo_bits/arma_forward.hpp:151:22: error: expected member name or ';' after declaration specifiers static constexpr bool is_xvec = false; ~~~~~~~~~~~~~~~~ ^ /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include/armadillo_bits/arma_forward.hpp:161:12: error: unknown type name 'constexpr' static constexpr bool is_row = false; ^ /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include/armadillo_bits/arma_forward.hpp:161:22: error: expected member name or ';' after declaration specifiers static constexpr bool is_row = false; ~~~~~~~~~~~~~~~~ ^ /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include/armadillo_bits/arma_forward.hpp:162:12: error: unknown type name 'constexpr' static constexpr bool is_col = false; ^ /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include/armadillo_bits/arma_forward.hpp:162:22: error: expected member name or ';' after declaration specifiers static constexpr bool is_col = false; ~~~~~~~~~~~~~~~~ ^ /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include/armadillo_bits/arma_forward.hpp:163:12: error: unknown type name 'constexpr' static constexpr bool is_xvec = true; ^ /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include/armadillo_bits/arma_forward.hpp:163:22: error: expected member name or ';' after declaration specifiers static constexpr bool is_xvec = true; ~~~~~~~~~~~~~~~~ ^ /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include/armadillo_bits/arma_forward.hpp:173:12: error: unknown type name 'constexpr' static constexpr bool is_row = false; ^ /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include/armadillo_bits/arma_forward.hpp:173:22: error: expected member name or ';' after declaration specifiers static constexpr bool is_row = false; ~~~~~~~~~~~~~~~~ ^ /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include/armadillo_bits/arma_forward.hpp:174:12: error: unknown type name 'constexpr' static constexpr bool is_col = true; ^ /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include/armadillo_bits/arma_forward.hpp:174:22: error: expected member name or ';' after declaration specifiers static constexpr bool is_col = true; ~~~~~~~~~~~~~~~~ ^ /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include/armadillo_bits/arma_forward.hpp:175:12: error: unknown type name 'constexpr' static constexpr bool is_xvec = false; ^ /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include/armadillo_bits/arma_forward.hpp:175:22: error: expected member name or ';' after declaration specifiers static constexpr bool is_xvec = false; ~~~~~~~~~~~~~~~~ ^ fatal error: too many errors emitted, stopping now [-ferror-limit=] 20 errors generated. make: *** [RcppExports.o] Error 1 ERROR: compilation failed for package ‘harmony’

  • removing ‘/Library/Frameworks/R.framework/Versions/4.0/Resources/library/harmony’ Error: Failed to install 'harmony-master.zip' from local: (converted from warning) installation of package ‘/var/folders/vh/npjhcwzj3hq7jbl_7xl382jh0000gn/T//RtmpAGjRdD/remotes6190459000ff/harmony-master’ had non-zero exit status

aimer-entropy avatar Dec 02 '20 06:12 aimer-entropy

I have the same problem installing the forecast package on MacOs Big Sur.

julia-kraus avatar Dec 16 '20 16:12 julia-kraus

@aimer-entropy @julia-kraus

Check your version of RcppArmadillo using RcppArmadillo::armadillo_version(single = F)

If your version is 10.1.0, this is the reason. Try installing an older version of RcppArmadillo, as suggested in the warning messages. Version 9.900.3 worked for me:

packageurl <- "https://cran.r-project.org/src/contrib/Archive/RcppArmadillo/RcppArmadillo_0.9.900.3.0.tar.gz"
install.packages(packageurl, repos=NULL, type="source")

Make sure to either restart R or detach and re-load the package in order to confirm the new version is being used.

If you need to, it is probably fine to update back to the newer version after you finish installing your package (forecast or Harmony), since compilation should only need to happen once.

dannyconrad avatar Dec 16 '20 22:12 dannyconrad

@aimer-entropy @julia-kraus

Check your version of RcppArmadillo using RcppArmadillo::armadillo_version(single = F)

If your version is 10.1.0, this is the reason. Try installing an older version of RcppArmadillo, as suggested in the warning messages. Version 9.900.3 worked for me:

packageurl <- "https://cran.r-project.org/src/contrib/Archive/RcppArmadillo/RcppArmadillo_0.9.900.3.0.tar.gz"
install.packages(packageurl, repos=NULL, type="source")

Make sure to either restart R or detach and re-load the package in order to confirm the new version is being used.

If you need to, it is probably fine to update back to the newer version after you finish installing your package (forecast or Harmony), since compilation should only need to happen once.

Thanks a lot. This works fine to me with the same installation problems.

Yunxiu123 avatar Dec 21 '20 12:12 Yunxiu123

@aimer-entropy @julia-kraus

I had the exact same issue that the above install of an older RcppArmadillo corrected. However, I'll add a nuance here. I tried the default harmony install on two separate machines. They both had RcppArmadillo 10.1.2, it worked on one and not on the other. They both have the same version of gcc, but I suspect that there was an issue with the one it did not work on with the correct compiler being defaulted to by R. Or perhaps it's a clang version issue?

And yes, defaulting back to the updated version of RccpArmadillo after install worked just fine.

kengel001 avatar Jan 27 '21 16:01 kengel001

@aimer-entropy @julia-kraus

Check your version of RcppArmadillo using RcppArmadillo::armadillo_version(single = F)

If your version is 10.1.0, this is the reason. Try installing an older version of RcppArmadillo, as suggested in the warning messages. Version 9.900.3 worked for me:

packageurl <- "https://cran.r-project.org/src/contrib/Archive/RcppArmadillo/RcppArmadillo_0.9.900.3.0.tar.gz"
install.packages(packageurl, repos=NULL, type="source")

Make sure to either restart R or detach and re-load the package in order to confirm the new version is being used.

If you need to, it is probably fine to update back to the newer version after you finish installing your package (forecast or Harmony), since compilation should only need to happen once.

Thanks,it really works.

JarvanDi avatar Mar 01 '21 02:03 JarvanDi

I had a similar Issue on macOS 11.1 Big Sur and couldn't get the Armadillo downgrade working. I then followed the error code which tells you to enable C++11 compiling mode. Following this tutorials https://gallery.rcpp.org/articles/first-steps-with-C++11/ first line of code did the trick for me:

Sys.setenv("PKG_CXXFLAGS"="-std=c++11")

ostkampp avatar Apr 15 '21 09:04 ostkampp

@pseudonym2 thank you so much, your advice did works.

elva0328 avatar Apr 26 '21 16:04 elva0328

I get this problem after trying to compile a simple method including RcppArmadillo.h I'm on a mac os Big sure, any help, please.

In file included from trying.cpp:4: In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include/RcppArmadillo.h:34: In file included from /Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include/Rcpp.h:57: /Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include/Rcpp/DataFrame.h:136:18: warning: unused variable 'data' [-Wunused-variable] SEXP data = Parent::get__(); ^ 1 warning generated. 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: *** [sourceCpp_24.so] Error 1 clang++ -mmacosx-version-min=10.13 -std=gnu++11 -I"/Library/Frameworks/R.framework/Resources/include" -DNDEBUG -I../inst/include -I"/Library/Frameworks/R.framework/Versions/4.0/Resources/library/Rcpp/include" -I"/Library/Frameworks/R.framework/Versions/4.0/Resources/library/RcppArmadillo/include" -I"/Applications/Diego Alejandro/2021-2 (Internship)/c++Projects/src1" -I/usr/local/include -std=c++11 -fPIC -Wall -g -O2 -c trying.cpp -o trying.o clang++ -mmacosx-version-min=10.13 -std=gnu++11 -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 sourceCpp_24.so trying.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 Error in Rcpp::sourceCpp("/Applications/Diego Alejandro/2021-2 (Internship)/c++Projects/src1/trying.cpp") : Error 1 occurred building shared library.

dportelacassab avatar May 08 '21 02:05 dportelacassab

Dear all,

Harmony is now available on CRAN! Please try to install through install.packages("harmony"). I hope this makes the process more painless and you can get back to your analyses faster.

Cheers, Ilya

ilyakorsunsky avatar Jun 17 '21 16:06 ilyakorsunsky