Hoping someone can help with this.
R version: 2.14.1
rpy2 version: 2.2.5
python version: 2.7.3
Been trying to load R venneuler package, which has rJava as a dependency, using rpy2 in a python script. Both venneuler and rJava succesfully load from within R environment. Other R libraries, such as 'stats','car',etc can be loaded in python using importr from rpy2.
Python code:
>from rpy2 import robjects
>from rpy2.robjects.packages import importr
>venn=importr('venneuler')
Which gives the following error:
Warning message:
In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, :
there is no package called ‘venneuler’
Error in .Primitive("as.environment")("package:venneuler") :
no item called "package:venneuler" on the search list
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/dist-packages/rpy2/robjects/packages.py", line 117, in importr
env = _as_env(rinterface.StrSexpVector(['package:'+name, ]))
rpy2.rinterface.RRuntimeError: Error in .Primitive("as.environment")("package:venneuler") :
no item called "package:venneuler" on the search list
In the course of troubleshooting, I tried to load rJava directly using importr:
>java=importr('rJava')
which get the following error,
Error : .onLoad failed in loadNamespace() for 'rJava', details:
call: dyn.load(file, DLLpath = DLLpath, ...)
error: unable to load shared object '/home/adam/R/x86_64-pc-linux-gnu-library/2.14/rJava/libs/rJava.so':
libjvm.so: cannot open shared object file: No such file or directory
Error in .Primitive("as.environment")("package:rJava") :
no item called "package:rJava" on the search list
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/dist-packages/rpy2/robjects/packages.py", line 117, in importr
env = _as_env(rinterface.StrSexpVector(['package:'+name, ]))
rpy2.rinterface.RRuntimeError: Error in .Primitive("as.environment")("package:rJava") :
no item called "package:rJava" on the search list
When I check '/home/adam/R/x86_64-pc-linux-gnu-library/2.14/rJava/libs/rJava.so' it exists and appears to be linked correctly to java dynamic libraries (e.g. ldd rJava.so).
Any ideas about how to fix this?