加载rpy2:ImportError:版本`GOMP_4.0'未找到

时间:2017-01-28 22:20:25

标签: python r rpy2

在Jupyter Notebook或控制台中加载rpy2会给我带来以下错误:

Traceback (most recent call last):
  File "/home/louis/anaconda3/lib/python3.5/runpy.py", line 184, in         _run_module_as_main
    "__main__", mod_spec)
  File "/home/louis/anaconda3/lib/python3.5/runpy.py", line 85, in     _run_code
    exec(code, run_globals)
  File "/home/louis/anaconda3/lib/python3.5/site-packages/rpy2/tests.py", line 23, in <module>
    import rpy2.tests_rpy_classic
  File "/home/louis/anaconda3/lib/python3.5/site-    packages/rpy2/tests_rpy_classic.py", line 3, in <module>
    import rpy2.rpy_classic as rpy
  File "/home/louis/anaconda3/lib/python3.5/site-packages/rpy2/rpy_classic.py", line 5, in <module>
    import rpy2.rinterface as ri
  File "/home/louis/anaconda3/lib/python3.5/site-packages/rpy2/rinterface/__init__.py", line 92, in <module>
    from rpy2.rinterface._rinterface import (baseenv,
ImportError: /home/louis/anaconda3/lib/libgomp.so.1: version `GOMP_4.0' not found (required by /usr/lib/R/lib/libR.so)
  • R版本:3.2.3
  • Python版本:3.5.2 :: Anaconda custom(64位)
  • OS:ubuntu 16.04 LTS 64 bit
  • rpy2版本:2.8.5

我不知道它有多相关,但是我安装了gcc,我可以在python中导入rpy2。

非常感谢任何帮助或提示。

按照omri_saadon的评论,我将LD_LIBRARY_PATH设置为导致libgomp目录的所有路径,它们是:

  • $ HOME / anaconda3 / PKGS / GCC-4.8.5-7 / lib中
  • $ HOME / anaconda3 / PKGS / libgcc中-4.8.5-2 / lib中
  • $ HOME / anaconda3 / PKGS / lib中

但每次都有同样的错误:

ImportError: path_to_libgomp/libgomp.so.1: version `GOMP_4.0' not found (required by /usr/lib/R/lib/libR.so)

所以我的任务继续^^(我必须承认我并不知道我在做什么的来龙去脉。) 当我成功设置export LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu(在root模式下找到)时,我有另一种错误:

    import rpy2.rinterface as ri                                                                             
  File "/home/louis/anaconda3/lib/python3.5/site-  packages/rpy2/rinterface/__init__.py", line 92, in <module> 
    from rpy2.rinterface._rinterface import (baseenv,                                                        
ImportError: /home/louis/anaconda3/bin/../lib/libreadline.so.6: undefined symbol: PC 

然后当我尝试首先导入readline包(因为它似乎与某些包合作)时,我得到:

import rpy2.rinterface as rinterface
  File "/home/louis/anaconda3/lib/python3.5/site-packages/rpy2/rinterface/__init__.py", line 92, in <module>
    from rpy2.rinterface._rinterface import (baseenv,
ImportError: /usr/lib/libblas.so.3: undefined symbol: gotoblas

2 个答案:

答案 0 :(得分:1)

看来我终于成功安装并使用了rpy2。

我做了什么?

我用conda包管理器安装它,而不是pip。只有conda install rpy2,我就完成了。

答案 1 :(得分:0)

你试过吗

RUN conda install -y gcc

这似乎适用于有类似问题的人 - Missing GOMP_parallel or GOMP_4.0 in (Docker) jupyter/all-spark-notebook: both R and Python