[Rcpp-devel] Fwd: Rcpp and rpy2

Jonas Rauch jonas.rauch at googlemail.com
Mon Aug 15 10:00:04 CEST 2011


Just to close this up:
I found out that my Rcpp installation must have occured when my R was not
built with shared lib. Thus Rcpp was not linked to libR. Just reinstalling
Rcpp from source solved the problem.

Regards,
Jonas

On Fri, Aug 12, 2011 at 3:16 PM, Dirk Eddelbuettel <edd at debian.org> wrote:

>
> On 12 August 2011 at 14:33, Jonas Rauch wrote:
> | 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?
>
> I would be somewhat hesitant to do so as it may affect all users of Rcpp.
>
> Rcpp is for getting code into R, and we can take libR as given as R is
> always
> around when loading Rcpp.  I think the problem is really with the linker
> and
> passing symbols through from one end to the other.
>
> Other views, anyone?
>
> Dirk
>
>
> | 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'
> |
> | From what I understand R_ClassSymbol is supplied by libR.so, which should
> by
> | loaded by rpy2 anyway in order to work at all, or am I totally wrong
> here?
> |
> | Running python 2.7.1, rpy2-2.2.2, R 2.13.0
> | I would appreciate any help.
> |
> | Regards,
> | Jonas
> |
> |
> | ----------------------------------------------------------------------
> | _______________________________________________
> | Rcpp-devel mailing list
> | Rcpp-devel at lists.r-forge.r-project.org
> | https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-devel
>
> --
> Two new Rcpp master classes for R and C++ integration scheduled for
> New York (Sep 24) and San Francisco (Oct 8), more details are at
>
> http://dirk.eddelbuettel.com/blog/2011/08/04#rcpp_classes_2011-09_and_2011-10
>
> http://www.revolutionanalytics.com/products/training/public/rcpp-master-class.php
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.r-forge.r-project.org/pipermail/rcpp-devel/attachments/20110815/0e919cce/attachment.htm>


More information about the Rcpp-devel mailing list