rpy2 加载某些生物导体包失败

rpy2 failed to load some bioconductor packages

最近我们的系统将 R 更新到 3.2.1(在单独的位置)。从那时起,我就无法在 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 笔记本中:

%load_ext rpy2.ipython

%%R
library(affy)

Error: package or namespace load failed for ‘affy’

我尝试了建议 here 但没有成功。

我正在使用 R 3.2.1、bioconductor 3.1、rpy2 2.6.1

谢谢!

错误消息指向 R 包 preprocessCore。 尝试重新安装。如果从 iPython 做所有事情:

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

完成后,如果安装成功完成,它应该可以运行:

from rpy2.robjects.packages import importr
base = importr('affy')