Unable to use Rcpp after conda install

北城以北 提交于 2019-12-24 08:58:30

问题


I installed R with conda

conda install -c r r-essentials

Now I cannot use the Rcpp library, even so it is installed with r-essentials. I get the following error:

# using library inline to compile a C++ code on the fly
library(inline)
library(Rcpp)
src <- '
   std::vector<std::string> s;
   s.push_back("hello");
   s.push_back("world");
   return Rcpp::wrap(s);
'
hellofun <- cxxfunction(body = src, includes = '', plugin = 'Rcpp', verbose = FALSE)
cat(hellofun(), '\n')


Error in dyn.load(libLFile): unable to load shared object '/tmp/Rtmp5N7UzX/file3a485578682c.so':
  /tmp/Rtmp5N7UzX/file3a485578682c.so: undefined symbol: _ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1ERKS4_
Traceback:

1. cxxfunction(body = src, includes = "", plugin = "Rcpp", verbose = FALSE)
2. dyn.load(libLFile)

I believe that this also affects compilation of modules not included in conda like rstan, which installation failed with a similar error.


回答1:


I know this is an old thread, however updating a response I received on Github.

I faced the same error with different package installation (in my case it was BCP). Based on the solution/work around provided here, the error in dyn.load() is no longer appearing. So it may be worth a try to update the R version using conda update r-essentials.



来源:https://stackoverflow.com/questions/40333691/unable-to-use-rcpp-after-conda-install

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!