rpy2无法加载某些生物导体包

2021-02-25 20:44:17 发布

您现在位置:Python中文网/ 问答频道 /正文

最近我们的系统更新了R到3.2.1(在一个单独的位置)。从那以后,我就很难在rpy2中加载某些包。在

我所做的:

  • 将LD_LIBRARY_PATH设置为当前路径
  • 卸载然后重新安装rpy2
  • 卸载,然后重新安装有问题的软件包

当我切换回以前的R安装时,它工作得很好(当然,对于旧的R版本,重新安装了rpy2)。而且它似乎并不影响所有的软件包。在

例如,加载“limma”就没有问题。但是加载'affy'时,我在python控制台中出现以下错误:

>>> from rpy2.robjects.packages import importr
>>> base = importr('affy')
/mnt/software/anaconda/envs/py2/lib/python2.7/site-packages/rpy2/robjects/packages.py:63: UserWarning: Error in dyn.load(file, DLLpath = DLLpath, ...) :
  unable to load shared object '/mnt/software/R-3.2.1/lib64/R/library/preprocessCore/libs/preprocessCore.so':
  /mnt/software/R-3.2.1/lib64/R/library/preprocessCore/libs/preprocessCore.so: undefined symbol: R_NaN

  return _reval(expr)
/mnt/software/anaconda/envs/py2/lib/python2.7/site-packages/rpy2/robjects/packages.py:438: UserWarning: Error in dyn.load(file, DLLpath = DLLpath, ...) :
  unable to load shared object '/mnt/software/R-3.2.1/lib64/R/library/preprocessCore/libs/preprocessCore.so':
/mnt/software/R-3.2.1/lib64/R/library/preprocessCore/libs/preprocessCore.so: undefined symbol: R_NaN

  env = _get_namespace(rname)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/mnt/software/anaconda/envs/py2/lib/python2.7/site-packages/rpy2/robjects/packages.py", line 438, in importr
    env = _get_namespace(rname)
rpy2.rinterface.RRuntimeError: Error in dyn.load(file, DLLpath = DLLpath, ...) :
  unable to load shared object '/mnt/software/R-3.2.1/lib64/R/library/preprocessCore/libs/preprocessCore.so':
  /mnt/software/R-3.2.1/lib64/R/library/preprocessCore/libs/preprocessCore.so: undefined symbol: R_NaN

在Ipython笔记本中:

^{pr2}$

我试着提出建议,但没有成功。在

我用的是R3.2.1,bioconductor 3.1,rpy2 2.6.1

谢谢!在

1条回答
网友
1楼 ·

错误消息指向R包preprocessCore。 请重新安装。如果从iPython开始做任何事情:

from rpy2.robjects import r
r_src = """
source("http://www.bioconductor.org/biocLite.R")
biocLite("preprocessCore")
"""
r(r_src)

完成后,如果安装成功完成,它应该可以工作:

^{pr2}$

相关问题