gpt4 book ai didi

Python rpy2 错误加载 edgeR R 包,但它已安装并在 R 中工作

转载 作者:行者123 更新时间:2023-11-28 17:28:32 25 4
gpt4 key购买 nike

我在使用 rpy2 在 Python 中加载 R 包 edgeR 时遇到问题。

当我运行时:

import rpy2.robjects as robjects

robjects.r('''
library(edgeR)
''')

我收到以下错误:

/home/user/.local/lib/python2.7/site-packages/rpy2/robjects/functions.py:106: UserWarning: Loading required package: limma

res = super(Function, self).__call__(*new_args, **new_kwargs)
/home/user/.local/lib/python2.7/site-packages/rpy2/robjects/functions.py:106: UserWarning: Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/data/scratch/user/source/anaconda/lib/R/library/edgeR/libs/edgeR.so':
/data/scratch/user/source/anaconda/lib/R/library/edgeR/libs/edgeR.so: undefined symbol: _ZNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEED1Ev

res = super(Function, self).__call__(*new_args, **new_kwargs)
/home/user/.local/lib/python2.7/site-packages/rpy2/robjects/functions.py:106: UserWarning: Error: package or namespace load failed for ‘edgeR’

res = super(Function, self).__call__(*new_args, **new_kwargs)
Traceback (most recent call last):
File "differential_expression.py", line 221, in <module>
diff_expr_object.run_edgeR()
File "differential_expression.py", line 127, in run_edgeR
probs = call_edger(data, groups, sizes, genes)
File "differential_expression.py", line 64, in call_edger
''')
File "/home/user/.local/lib/python2.7/site-packages/rpy2/robjects/__init__.py", line 321, in __call__
res = self.eval(p)
File "/home/user/.local/lib/python2.7/site-packages/rpy2/robjects/functions.py", line 178, in __call__
return super(SignatureTranslatedFunction, self).__call__(*args, **kwargs)
File "/home/user/.local/lib/python2.7/site-packages/rpy2/robjects/functions.py", line 106, in __call__
res = super(Function, self).__call__(*new_args, **new_kwargs)
rpy2.rinterface.RRuntimeError: Error: package or namespace load failed for ‘edgeR’

主要问题是:

rpy2.rinterface.RRuntimeError: Error: package or namespace load failed for ‘edgeR’

但是,当我运行以下命令时:

R
> library(edgeR)
> sessionInfo()
R version 3.2.2 (2015-08-14)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: CentOS release 6.5 (Final)

locale:
[1] LC_CTYPE=en_ZA.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_ZA.UTF-8 LC_COLLATE=en_ZA.UTF-8
[5] LC_MONETARY=en_ZA.UTF-8 LC_MESSAGES=en_ZA.UTF-8
[7] LC_PAPER=en_ZA.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_ZA.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] edgeR_3.12.0 limma_3.26.9
>

我可以看到 edgeR 已成功安装并在 R 中运行。为什么它不能在 Python 中工作?我试图从 rpy2 加载其他包,例如library(tools) 运行良好。

最佳答案

错误是:

UserWarning: Error in dyn.load(file, DLLpath = DLLpath, ...) : 
unable to load shared object '/data/scratch/user/source/anaconda/lib/R/library/edgeR/libs/edgeR.so':
/data/scratch/user/source/anaconda/lib/R/library/edgeR/libs/edgeR.so: undefined symbol: _ZNSt7__cxx1118basic_stringstreamIcSt11char_traitsIcESaIcEED1Ev

无法加载 edgeR 的 C 库。您是否了解如何安装 R 和 edgeR 的详细信息? (我可以看到涉及anaconda)。

关于Python rpy2 错误加载 edgeR R 包,但它已安装并在 R 中工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36468707/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com