最近我们的系统将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 Notebook中:
%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
谢谢!
答案 0 :(得分: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')