[Rcpp-devel] Fwd: Rcpp and rpy2

Jonas Rauch jonas.rauch at googlemail.com
Fri Aug 12 14:33:18 CEST 2011


Hi Dirk and Romain,

Aparrently libR is not loaded by rpy2, at least not in a way such that Rcpp
can access it. I have solved the problem by adding -lR to the linker flags
when building Rcpp. Since for normal use of Rcpp from R this does not make a
difference, would you mind adding this to the Makevars file in a future
version of Rcpp? Or does this lead to problems in case R is build without
libR.so?

Best regards,
Jonas

---------- Forwarded message ----------
From: Jonas Rauch <jonas.rauch at googlemail.com>
Date: Fri, Aug 12, 2011 at 10:36 AM
Subject: Rcpp and rpy2
To: rcpp-devel <rcpp-devel at r-forge.wu-wien.ac.at>


Is Rcpp compatible with rpy2?
I would like to call a very complex R function from python. My function
depends on code implemented with Rcpp. When I try to load Rcpp from python
via

import rpy2.robjects as robjects
robjects.r('library(Rcpp)')

I get the following:

Error in dyn.load(file, DLLpath = DLLpath, ...) :
  unable to load shared object
'/home/jonas/R/x86_64-unknown-linux-gnu-library/2.13/Rcpp/libs/Rcpp.so':
  /home/jonas/R/x86_64-unknown-linux-gnu-library/2.13/Rcpp/libs/Rcpp.so:
undefined symbol: R_ClassSymbol
Error: package/namespace load failed for 'Rcpp'
Traceback (most recent call last):
  File "RcppTest.py", line 2, in <module>
    robjects.r('library(Rcpp)')
  File
"/usr/local/lib/python2.7/dist-packages/rpy2-2.2.2dev_20110811-py2.7-linux-x86_64.egg/rpy2/robjects/__init__.py",
line 225, in __call__
    res = self.eval(p)
  File
"/usr/local/lib/python2.7/dist-packages/rpy2-2.2.2dev_20110811-py2.7-linux-x86_64.egg/rpy2/robjects/functions.py",
line 82, in __call__
    return super(SignatureTranslatedFunction, self).__call__(*args,
**kwargs)
  File
"/usr/local/lib/python2.7/dist-packages/rpy2-2.2.2dev_20110811-py2.7-linux-x86_64.egg/rpy2/robjects/functions.py",
line 34, in __call__
    res = super(Function, self).__call__(*new_args, **new_kwargs)
rpy2.rinterface.RRuntimeError: Error: package/namespace load failed for
'Rcpp'



More information about the Rcpp-devel mailing list