首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在macOS中使用conda环境下的R包

在macOS中使用conda环境下的R包
EN

Stack Overflow用户
提问于 2021-07-21 20:07:02
回答 1查看 2.3K关注 0票数 1

我试图在macOS中的conda环境中使用一个包含Rcpp + OpenMP的R包。我阅读了conda环境文档;但是,在下面的可复制示例中,我无法解决我遇到的问题。大多数文档都基于解决OpenMP问题(clang+llvm)的macOS。我想知道是否有用于conda环境的任何资源或文档。这些步骤在Linux系统(使用conda)和macOS (没有conda)上工作,没有任何问题。

下面是一个可重复的例子:

在macOS中:

步骤1:创建conda环境并安装R:

代码语言:javascript
复制
conda create -n env r-essentials r-base

步骤2:激活环境

代码语言:javascript
复制
conda activate env

步骤3:安装rstudio

代码语言:javascript
复制
conda install -c r rstudio

步骤4:安装一些必需的软件包

代码语言:javascript
复制
conda install -c r r-devtools
conda install -c r r-wcorr
conda install -c r r-ranger
conda install -c conda-forge r-rcpparmadillo
conda install -c r r-testthat
conda install -c conda-forge r-superlearner
conda install -c conda-forge r-polycore
conda install -c conda forge r-logger
conda install -c anaconda llvm
conda install -c conda-forge openmp

步骤5:运行rstudio

步骤6:在rstudio内部

代码语言:javascript
复制
library('devtools')
install_github('fasrc/CausalGPS')

我得到以下错误:

代码语言:javascript
复制
In file included from ColorSpace.cpp:1:
In file included from ./ColorSpace.h:4:
In file included from env/bin/../include/c++/v1/typeinfo:60:
In file included from env/bin/../include/c++/v1/exception:81:
In file included from env/bin/../include/c++/v1/cstdlib:85:
In file included from env/bin/../include/c++/v1/stdlib.h:100:
env/bin/../include/c++/v1/math.h:773:12: error: no member named 'labs' in the global namespace; did you mean 'abs'?
 return ::labs(__x);
     ~~^
~/env/bin/../include/c++/v1/math.h:772:39: note: 'abs' declared here
inline _LIBCPP_INLINE_VISIBILITY long abs(long __x) _NOEXCEPT {
                   ^
~/env/bin/../include/c++/v1/math.h:777:12: error: no member named 'llabs' in the global namespace
 return ::llabs(__x);
     ~~^
~/env/bin/../include/c++/v1/math.h:785:12: error: no member named 'fabsf' in the global namespace
 return ::fabsf(__lcpp_x);
     ~~^
~/env/bin/../include/c++/v1/math.h:789:12: error: no member named 'fabs' in the global namespace; did you mean 'abs'?
 return ::fabs(__lcpp_x);
     ~~^
~/env/bin/../include/c++/v1/math.h:772:39: note: 'abs' declared here
inline _LIBCPP_INLINE_VISIBILITY long abs(long __x) _NOEXCEPT {
                   ^
~/env/bin/../include/c++/v1/math.h:794:12: error: no member named 'fabsl' in the global namespace
 return ::fabsl(__lcpp_x);
 ~~^

我认为我需要设置一些环境变量;但是,我无法找到应该导出哪些变量。你有什么想法吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-07-22 23:01:24

适用于我,但我认为这是一种更好的做法:

see alternatives

  • only使用 Conda -锻造信道混合通道可以有动态库问题,

  • include (除了其他packages)

  • 使用了mamba,因为conda是慢的H 222f 223>F 223

下面是一个用于创建环境的YAML:

causalgps-env.yaml

代码语言:javascript
复制
name: causalgps
channels:
  - conda-forge
dependencies:
  - r-base=4.1
  - r-tidyverse
  - r-devtools
  - r-xgboost
  - r-superlearner
  - r-earth
  - r-ranger
  - r-gam
  - r-kernsmooth
  - r-gnm
  - r-polycor
  - r-wcorr
  - r-rlang
  - r-glue
  - r-logger
  - r-cli>=2,<3

这些步骤是:

如果没有

  1. Create env .安装Mamba,则## conda安装-n base forge::mamba env创建-n causalgps -f causalgps-env.yaml

  1. Run R会话在env.

conda激活烧碱R

  1. Install包.

图书馆(Devtools) install_github('fasrc/CausalGPS')

  1. Test加载.

图书馆(CausalGPS) ## works

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68475864

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档