On 14/01/10 04:04, Guozhu.Wen wrote:
Hi, I use rpy2 2.0.6, I encountered some errors when I load('mypackage') within rpy2 by r.source(rfile). Woudl you help me?

The environment variable R_LD_LIBRARY_PATH defined in my $RHOME/etc/ldpaths is :
${R_LD_LIBRARY_PATH=${R_HOME}/lib:/usr/local/lib:}

I added the path "/usr/local/lib" because when I use library('mypackage') in the R console, my R package must link some *.so located in "/usr/local/lib". Now It worked in R console, but not in rpy2. When I load "mypackage" in rpy2, it raise Exception telling me cannot find some *.so which actually localed in "/usr/local/lib". So I think maybe rpy2 don't use the configuration defined in $RHOME/etc/ldpaths.
I think that there are two possible reasons for this, and two ways to solve it.

- $RHOME/etc/ldpaths is ignored when an embedded R is started with the option "--vanilla" (and this is what rpy2 has by default - may be not such a good thing). Try if the following helps:

#do this *before* your import anything from rpy2
import rpy2.rinterface as ri
ri.set_initoptions(('--quiet', '--no-save'))
# now import whatever from rpy2 as usual

Documentation for that at:
http://rpy.sourceforge.net/rpy2/doc-2.1/html/rinterface.html#initialization

- $RHOME/etc/ldpaths is only used by the R console (and rpy/rpy2 have use an embedded R that can't know about it). In that case, you should define your LD_LIBRARY_PATH *before* starting python.
For example:
source $RHOME/etc/ldpaths
python



L.


PS: rpy2-2.0.8 is out, and 2.1.0 is almost there.


Would you plan to add R's ldpaths in rpy2? Thanks.

--
Guozhu. Wen
mail: guozhu...@gmail.com <mailto:guozhu...@gmail.com>
douban: http://www.douban.com/people/wentrue/
blog: http://www.wentrue.net/blog/
twitter: https://twitter.com/wentrue


------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev


_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
rpy-list mailing list
rpy-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rpy-list

Reply via email to