-1

Recently our system updated R to 3.2.1 (in a separate location). Since then I have trouble loading certain packages in rpy2.

What I have tried:

  • set LD_LIBRARY_PATH to current path
  • un-install then reinstall rpy2
  • un-install then reinstall packages with problem

It works fine when I switch back to previous R installation (of course with re-installed rpy2 for the older R version). And it does not seem to affect all packages.

For example, loading 'limma' has no issue. but loading 'affy', I have following error in python console:

>>> 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

And in Ipython Notebook:

%load_ext rpy2.ipython

%%R
library(affy)

Error: package or namespace load failed for ‘affy’

I tried suggestion here without success.

I am using R 3.2.1, bioconductor 3.1, rpy2 2.6.1

Thanks!

Community
  • 1
  • 1
xyliu00
  • 726
  • 1
  • 9
  • 24

1 Answers1

1

The error message is pointing toward the R package preprocessCore. Try installing it again. If doing everything from iPython:

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

When done, and if the installation finishes succcesfully, it should work:

from rpy2.robjects.packages import importr
base = importr('affy')
lgautier
  • 11,363
  • 29
  • 42
  • Thanks! this solved the problem for affy. I went on to test other package 'simpleaffy'. Got the same problem. So I did the same thing you did for 'proprocessCore' to install: XML, RSQllite, genefilter, XVector... And hunt is continuing. Why these are happening. Is there a way to fix all? – xyliu00 Aug 08 '15 at 04:08
  • I don't know why this is happening. Your system / installation seems unable to link a package's `.so` with the correct R shared library. – lgautier Aug 08 '15 at 19:50