希望有人能帮助这一点。
[R版本:2.14.1
rpy2版本:2.2.5
Python版本:2.7.3
一直试图负载R venneuler包,其具有rJava作为依赖,在Python脚本使用rpy2。 既venneuler和来自R环境中成功地rJava负载。 其它的R库,如“统计”,“汽车”,等可以在python使用importr从rpy2加载。
Python代码:
>from rpy2 import robjects
>from rpy2.robjects.packages import importr
>venn=importr('venneuler')
这提供了以下错误:
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
在解决问题的过程中,我尝试使用直接到importr加载rJava:
>java=importr('rJava')
这得到下列错误,
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
当我检查“/home/adam/R/x86_64-pc-linux-gnu-library/2.14/rJava/libs/rJava.so”它的存在,似乎是正确链接到Java的动态链接库(例如LDD rJava.so) 。
关于如何解决这个问题的任何想法?