Amanda Miotto <a.miotto <at> griffith.edu.au> writes: > > Dear All > > I have had issues with both rpy and rpy2 when it comes to using a library > that uses rJava. The error is below > > using rpy > > >>> r.library('GenePattern') > Loading required package: rJava > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > rpy.RPy_RException: Error: package 'rJava' could not be loaded > > Using rpy2 > > >>> getexpression('/home/.../ArrayExpress/Tools/head.Fibro_Sz_Vs_Controls_Sample_Pro be_Profile.txt.proc') > Loading required package: rJava > Error : .onLoad failed in loadNamespace() for 'rJava', details: > call: dyn.load(file, DLLpath = DLLpath, ...) > error: unable to load shared library '/home/.../R/i486-pc-linux-gnu- library/2.6/rJava/libs/rJava.so': > libjvm.so: cannot open shared object file: No such file or directory > In addition: Warning messages: > 1: In cbind(rep(names(exptable2)[i], dim(exptable2)[2]), probes, exptable2[, : > number of rows of result is not a multiple of vector length (arg 2) > 2: In cbind(rep(names(exptable2)[i], dim(exptable2)[2]), probes, exptable2[, : > number of rows of result is not a multiple of vector length (arg 2) > 3: In cbind(rep(names(exptable2)[i], dim(exptable2)[2]), probes, exptable2[, : > number of rows of result is not a multiple of vector length (arg 2) > 4: In cbind(rep(names(exptable2)[i], dim(exptable2)[2]), probes, exptable2[, : > number of rows of result is not a multiple of vector length (arg 2) > Error: package 'rJava' could not be loaded > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > File "<stdin>", line 35, in getexpression > File "/usr/lib/python2.5/site-packages/rpy2/robjects/functions.py", line > 83, in __call__ > return super(SignatureTranslatedFunction, self).__call__(*args, **kwargs) > File "/usr/lib/python2.5/site-packages/rpy2/robjects/functions.py", line > 35, in __call__ > res = super(Function, self).__call__(*new_args, **new_kwargs) > rpy2.rinterface.RRuntimeError: Error: package 'rJava' could not be loaded > > >>> > > rJava is installed and at the address that is listed. When I run the script through R it works correctly. Any advice? > > ------------------------------------------------------------------------------ > Beautiful is writing same markup. Internet Explorer 9 supports > standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3. > Spend less time writing and rewriting code and more time creating great > experiences on the web. Be a part of the beta today. > http://p.sf.net/sfu/beautyoftheweb >
I'm not sure why it happens, but here's a quick workaround. 1.) Find out where libjvm.so is actually located. On my Debian system, it's located here: $ locate libjvm.so ... /usr/lib/jvm/java-6-sun-1.6.0.21/jre/lib/amd64/server/libjvm.so ... This will vary based on your system and how you have Java installed. 2.) Link it to a global library path, like /usr/lib $ sudo ln -s /path/to/libjvm.so /usr/lib 3.) Ensure rJava.so can find it: $ ldd /path/to/rJava.so ... libjvm.so => /usr/lib/libjvm.so (0x00007fead1f8e000) ... For reference, before I symlinked libjvm.so, the output was the following: $ ldd /path/to/rJava.so ... libjvm.so => not found ... 4.) Ensure rpy2 finds it: $ python -c "from rpy2 import robjects; robjects.r('library(rJava)')" (should return nothing) Hope that helps! Yacin ------------------------------------------------------------------------------ Beautiful is writing same markup. Internet Explorer 9 supports standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3. Spend less time writing and rewriting code and more time creating great experiences on the web. Be a part of the beta today. http://p.sf.net/sfu/beautyoftheweb _______________________________________________ rpy-list mailing list rpy-list@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rpy-list