satijalab / sctransform

R package for modeling single cell UMI expression data using regularized negative binomial regression
GNU General Public License v3.0
203 stars 33 forks source link

Cannot install on arm64 #135

Closed skilpinen closed 2 years ago

skilpinen commented 2 years ago

Hi,

Any attempt to install this package (same with master and develop) to Arm64 Mac leads to error below. What is this about?

remotes::install_github("satijalab/sctransform", ref="develop") Downloading GitHub repo satijalab/sctransform@develop ✔ checking for file ‘/private/var/folders/jb/8nrbz8jx5v78ly5_0kvgx49c0000gn/T/RtmpQBcrbr/remotes1132274ac8bdc/satijalab-sctransform-e9e52a4/DESCRIPTION’ (442ms) ─ preparing ‘sctransform’: ✔ checking DESCRIPTION meta-information ... ─ cleaning src ─ installing the package to process help pages

─ installing source package ‘sctransform’ ... using staged installation libs arm64-apple-darwin20.0.0-clang++ -std=gnu++11 -I"/opt/homebrew/Caskroom/miniforge/base/envs/r412_arm/lib/R/include" -DNDEBUG -I'/opt/homebrew/Caskroom/miniforge/base/envs/r412_arm/lib/R/library/RcppArmadillo/include' -I'/opt/homebrew/Caskroom/miniforge/base/envs/r412_arm/lib/R/library/Rcpp/include' -D_FORTIFY_SOURCE=2 -isystem /opt/homebrew/Caskroom/miniforge/base/envs/r412_arm/include -mmacosx-version-min=11.0 -I/opt/homebrew/Caskroom/miniforge/base/envs/r412_arm/include -fPIC -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden -fmessage-length=0 -isystem /opt/homebrew/Caskroom/miniforge/base/envs/r412_arm/include -fdebug-prefix-map=/Users/runner/miniforge3/conda-bld/r-base-split_1642327593909/work=/usr/local/src/conda/r-base-4.1.2 -fdebug-prefix-map=/opt/homebrew/Caskroom/miniforge/base/envs/r412_arm=/usr/local/src/conda-prefix -Wall -pedantic -fdiagnostics-color=always -c RcppExports.cpp -o RcppExports.o In file included from RcppExports.cpp:4: In file included from /opt/homebrew/Caskroom/miniforge/base/envs/r412_arm/lib/R/library/RcppArmadillo/include/RcppArmadillo.h:29: In file included from /opt/homebrew/Caskroom/miniforge/base/envs/r412_arm/lib/R/library/RcppArmadillo/include/RcppArmadilloForward.h:48: In file included from /opt/homebrew/Caskroom/miniforge/base/envs/r412_arm/lib/R/library/RcppArmadillo/include/armadillo:380: /opt/homebrew/Caskroom/miniforge/base/envs/r412_arm/lib/R/library/RcppArmadillo/include/armadillo_bits/eop_aux.hpp:99:124: error: no member named 'Rlog1p' in namespace 'std'; did you mean 'log1p'? template arma_inline static typename arma_integral_only::result log1p (const eT x) { return eT( std::log1p(double(x)) ); }


                                                                                                                              log1p
   /opt/homebrew/Caskroom/miniforge/base/envs/r412_arm/lib/R/include/Rmath.h:71:15: note: expanded from macro 'log1p'
   #define log1p Rlog1p
                 ^
   /opt/homebrew/Caskroom/miniforge/base/envs/r412_arm/bin/../include/c++/v1/cmath:433:9: note: 'log1p' declared here
   using ::log1p _LIBCPP_USING_IF_EXISTS;
           ^
   In file included from RcppExports.cpp:4:
   In file included from /opt/homebrew/Caskroom/miniforge/base/envs/r412_arm/lib/R/library/RcppArmadillo/include/RcppArmadillo.h:29:
   In file included from /opt/homebrew/Caskroom/miniforge/base/envs/r412_arm/lib/R/library/RcppArmadillo/include/RcppArmadilloForward.h:48:
   In file included from /opt/homebrew/Caskroom/miniforge/base/envs/r412_arm/lib/R/library/RcppArmadillo/include/armadillo:380:
   /opt/homebrew/Caskroom/miniforge/base/envs/r412_arm/lib/R/library/RcppArmadillo/include/armadillo_bits/eop_aux.hpp:100:115: error: no member named 'Rlog1p' in namespace 'std'; did you mean simply 'Rlog1p'?
     template<typename eT> arma_inline static typename       arma_real_only<eT>::result log1p (const eT  x) { return std::log1p(x);               }
                                                                                                                     ^~~~~~~~~~
                                                                                                                     Rlog1p
   /opt/homebrew/Caskroom/miniforge/base/envs/r412_arm/lib/R/library/RcppArmadillo/include/armadillo_bits/eop_aux.hpp:101:86: note: 'Rlog1p' declared here
     template<typename eT> arma_inline static typename         arma_cx_only<eT>::result log1p (const eT& x) { arma_ignore(x); return eT(0);       }
                                                                                        ^
   /opt/homebrew/Caskroom/miniforge/base/envs/r412_arm/lib/R/include/Rmath.h:71:15: note: expanded from macro 'log1p'
   #define log1p Rlog1p
                 ^
   In file included from RcppExports.cpp:4:
   In file included from /opt/homebrew/Caskroom/miniforge/base/envs/r412_arm/lib/R/library/RcppArmadillo/include/RcppArmadillo.h:29:
   In file included from /opt/homebrew/Caskroom/miniforge/base/envs/r412_arm/lib/R/library/RcppArmadillo/include/RcppArmadilloForward.h:48:
   In file included from /opt/homebrew/Caskroom/miniforge/base/envs/r412_arm/lib/R/library/RcppArmadillo/include/armadillo:440:
   /opt/homebrew/Caskroom/miniforge/base/envs/r412_arm/lib/R/library/RcppArmadillo/include/armadillo_bits/fn_misc.hpp:172:21: error: no member named 'Rlog1p' in namespace 'std'; did you mean simply 'Rlog1p'?
       return (log_a + std::log1p(std::exp(negdelta)));
                       ^~~~~~~~~~
                       Rlog1p
   /opt/homebrew/Caskroom/miniforge/base/envs/r412_arm/lib/R/include/Rmath.h:70:9: note: 'Rlog1p' declared here
   double  Rlog1p(double);
           ^
   3 errors generated.
   make: *** [/opt/homebrew/Caskroom/miniforge/base/envs/r412_arm/lib/R/etc/Makeconf:177: RcppExports.o] Error 1
   ERROR: compilation failed for package ‘sctransform’
─  removing ‘/private/var/folders/jb/8nrbz8jx5v78ly5_0kvgx49c0000gn/T/RtmpTGatHe/Rinst11eaa7cedd496/sctransform’
         -----------------------------------
   ERROR: package installation failed
Error: Failed to install 'sctransform' from GitHub:
  System command 'R' failed, exit status: 1, stdout & stderr were printed
saketkc commented 2 years ago

This appears to be arising from your installed version of Rcpparmadillo not having required flags set for arm64, see related issue, though it seems to have been fixed upstream. I would recommend creating a new conda environment with updated packages or updating packages in your current enironment before installing sctransform.

genecell commented 2 years ago

As mentioned in https://github.com/conda-forge/r-base-feedstock/issues/163#issuecomment-1172913391, I successfully installed sctransform in Mac silicon M1 Max by first run export PKG_CPPFLAGS="-DHAVE_WORKING_LOG1P in the terminal and then install the package in R.