Getting Segmentation fault Core dumped error while importing robjects from rpy2

社会主义新天地 提交于 2019-11-28 11:40:15

If you install rpy2 via conda, and also have a system installation of R on the same machine (e.g with RStudio), the system's R installation will be used. Since this R version doesn't match the one that rpy2 needs, segmentation faults occur.

1) remove any existing system installations of R (see here). Verify that you don't have any installations of R:

$>which R
R not found

2) define R_HOME env variable, either in your .rc file:

export R_HOME=/Users/<your user>/anaconda3/envs/<env name>/lib/R

or dynamically in the python project:

import os
os.environ['R_HOME'] = '/Users/<your user>/anaconda3/envs/<env name>/lib/R'
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!