I am trying to use rpy to run a file with a bunch of linear models like the following: from rpy import * output = r.source("linear_models.R") In linear_models.R, I have some commands like m1 = lm(Y ~ X1 + X2) print(summary(m1)) It appears that rpy fails to load lapack.so (necessary for doing the linear models). The error message is Warning message: unable to load shared library "/usr/lib/R/modules/lapack.so": libRlapack.so: cannot open shared object file: No such file or directory Traceback (most recent call last): File "./analysis.py", line 44, in ? output = r.source("linear_models.R") rpy.RException: Error in La.chol2inv(x, size) : lapack routines cannot be loaded I checked, I have a /usr/lib/R/modules/lapack.so, but when I run ldd on that I get: $ ldd lapack.so libR.so => not found libRlapack.so => not found libg2c.so.0 => /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.4/libg2c.so.0 (0x40020000) libm.so.6 => /lib/libm.so.6 (0x4003e000) libgcc_s.so.1 => /usr/lib/gcc-lib/i686-pc-linux-gnu/3.3.4/libgcc_s.so.1 (0x40060000) libpcre.so.0 => /usr/lib/libpcre.so.0 (0x4006a000) libbz2.so.1.0 => /usr/lib/libbz2.so.1.0 (0x4007b000) libreadline.so.4 => /lib/libreadline.so.4 (0x4008a000) libdl.so.2 => /lib/libdl.so.2 (0x400b7000) libncurses.so.5 => /lib/libncurses.so.5 (0x400ba000) libc.so.6 => /lib/libc.so.6 (0x400ff000) /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x80000000) So it appears that python can't find libRlapack.so because it isn't in a standard location (it is in /usr/lib/R/bin). I tried $ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/R/bin That seems to work. Reproducible: Always Steps to Reproduce: 1. Write R batch file using a linear model ( lm() function ) 2. r.source() the file from a python script using rpy 3. Actual Results: see error message above Expected Results: output from a linear model (R: lm() function)
yeah, there's some problems with the way that the libraries are put in. maybe we should add /usr/lib/R/{bin,lib} to /etc/env.d probably is that that location has changed between R-1.99 and R-2.0.0
Oops, good point about the version: I should have said that I am using R Version 1.9.1.
Hmm, what't the status here?
I have updated my R version to 2.1.0-r1: Hm, I now have a /etc/env.d/99R which belongs to dev-lang/R, which sets LDPATH=/usr/lib/R/lib, but I am not sure this does anything (echo $LDPATH produces an empty line). In any case, my testcase doesn't produce any problems anymore. I guess this means it can be closed?
the 99R-file adds this path to /etc/ld.so.conf, so the linker can find files there. Looks like this is fixed for all R versions currently in portage. This was actually fixed because of bug #90601 - looks like I underestimated the consequences of the missing path. Sorry.