On 1/14/10 3:19 PM, Guozhu.Wen wrote:
> Thanks for you reply. The first way doesn't work, but the second way do.
> However, the second solution seems ugly. Ignoring the ldpaths
> configuration when the embedded R is started might not be a good idea,
> in my opinion.

Well, if you think so this is a request to address the R developers; 
Rpy2 is embedding R, and as such is using the C-level API provided to do so.

However, note that there is a significant chance that someone thinks 
that editing ${RHOME}/etc/ldpaths is even less a good idea.
The environment variable LD_LIBRARY_PATH is generally accepted as the 
one to use when libraries are in exotic locations.

L.



> On Thu, Jan 14, 2010 at 3:31 PM, Laurent <lgaut...@gmail.com
> <mailto:lgaut...@gmail.com>> wrote:
>
>     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  <mailto:rpy-list@lists.sourceforge.net>
>>     https://lists.sourceforge.net/lists/listinfo/rpy-list
>>
>
>
>
>
> --
> 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

Reply via email to