【发布时间】:2016-04-07 09:31:13
【问题描述】:
我有一个关于 GOMP 的问题,我认为这与 gcc 有关。
我使用这张图片作为一些实验的基础。似乎我正在使用基于此未修改图像的正常版本(4.9.2),但我在一些与 Cython 相关的软件包中出现了一些奇怪的行为。
示例 1
在未修改的 jupyter/all-spark-notebook docker 映像上运行此命令时,尝试运行 Python 时出现以下问题,
import lightfm
Traceback (most recent call last):
File "", line 1, in
File "/opt/conda/lib/python3.4/site-packages/lightfm/init.py", line 1, in
from .lightfm import LightFM
File "/opt/conda/lib/python3.4/site-packages/lightfm/lightfm.py", line 7, in
from .lightfm_fast import (CSRMatrix, FastLightFM,
ImportError: /opt/conda/lib/python3.4/site-packages/lightfm/lightfm_fast.cpython-34m.so:
undefined symbol: GOMP_parallel
我尝试过的事情:
-
转到文件 lightfm.py 并将所有依赖项移动到一行,如下所示:
from .lightfm_fast import (CSRMatrix, FastLightFM, fit_logistic, predict_lightfm, fit_warp, fit_bpr, fit_warp_kos)
到
from .lightfm_fast import (CSRMatrix, FastLightFM, fit_logistic, predict_lightfm, fit_warp, fit_bpr, fit_warp_kos).
同样的错误。
还尝试将“.lightfm”从相对导入更改为“lightfm”。同样的错误。
Checking gcc and kernel versions: gcc 4.9.2 Ubuntu 14.04 Linux 00846c176840 3.13.0-67-generic #110-Ubuntu SMP Fri Oct 23 13:24:41 UTC 2015 x86_64 GNU/Linux
但我认为,如果您只是拉取 docker 映像并执行 pip install lightfm 它应该会准确地复制错误。
示例 2
运行pip install xgboost时,安装成功,但在笔记本中我尝试这样做:
---------------------------------------------------------------------------
OSError Traceback (most recent call last)
<ipython-input-2-afdaff4619ce> in <module>()
----> 1 import xgboost
/home/jovyan/.local/lib/python3.5/site-packages/xgboost-0.4-py3.5.egg/xgboost/__init__.py in <module>()
9 import os
10
---> 11 from .core import DMatrix, Booster
12 from .training import train, cv
13 from . import rabit
/home/jovyan/.local/lib/python3.5/site-packages/xgboost-0.4-py3.5.egg/xgboost/core.py in <module>()
81
82 # load the XGBoost library globally
---> 83 _LIB = _load_lib()
84
85 def _check_call(ret):
/home/jovyan/.local/lib/python3.5/site-packages/xgboost-0.4-py3.5.egg/xgboost/core.py in _load_lib()
75 if len(lib_path) == 0:
76 return None
---> 77 lib = ctypes.cdll.LoadLibrary(lib_path[0])
78 lib.XGBGetLastError.restype = ctypes.c_char_p
79 return lib
/opt/conda/lib/python3.5/ctypes/__init__.py in LoadLibrary(self, name)
423
424 def LoadLibrary(self, name):
--> 425 return self._dlltype(name)
426
427 cdll = LibraryLoader(CDLL)
/opt/conda/lib/python3.5/ctypes/__init__.py in __init__(self, name, mode, handle, use_errno, use_last_error)
345
346 if handle is None:
--> 347 self._handle = _dlopen(self._name, mode)
348 else:
349 self._handle = handle
OSError: /opt/conda/bin/../lib/libgomp.so.1: version `GOMP_4.0' not found (required by /home/jovyan/.local/lib/python3.5/site-packages/xgboost-0.4-py3.5.egg/xgboost/libxgboost.so)
我刚刚注意到这是一种反复出现的模式,有时可能会受到很大限制,但我不太了解编译器是否知道这是否真的是图像的问题,或者这不是真正的“问题”,而是一个设计决定。有什么想法吗?
非常感谢!
我尝试过的事情:
我试过了
conda install -c https://conda.anaconda.org/anaconda gcc在终端 但无济于事。-
另外,当我尝试在 R 中执行
install.packages('xgboost')(等效)时,我得到了这个错误:错误:'xgboost' 的 loadNamespace() 中的 .onLoad 失败,详细信息: 调用:dyn.load(file, DLLpath = DLLpath, ...) 错误:无法加载共享对象'/usr/local/spark-1.6.0-bin-hadoop2.6/R/lib/xgboost/libs/xgboost.so': /usr/local/spark-1.6.0-bin-hadoop2.6/R/lib/xgboost/libs/xgboost.so:未定义符号:GOMP_parallel
sudo apt-get install libgomp1 也没有帮助我,因为它已经安装了。
- 根据 Jupyter I 项目的某人的建议
运行
conda list并找到这一行:libgcc 4.8.5 1 r
但是没有 gcc 我也有 glib。 但在终端:
jovyan@aaaaaaa:~/work$ gcc --version
gcc (Debian 4.9.2-10) 4.9.2
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
更新:我现在认为检测到的编译器实际上是一个早期版本,所以这可能是问题的根源,因为在运行时
%install_ext https://raw.githubusercontent.com/rasbt/watermark/master/watermark.py
%load_ext watermark
# show a watermark for this environment
%watermark -d -m -v -p numpy,matplotlib -g
我收到以下回复:
CPython 2.7.11
IPython 4.1.2
numpy 1.10.4
matplotlib 1.5.1
compiler : GCC 4.4.7 20120313 (Red Hat 4.4.7-1)
system : Linux
release : 4.4.5-15.26.amzn1.x86_64
machine : x86_64
processor :
CPU cores : 4
interpreter: 64bit
Git hash :
还有其他想法吗?
【问题讨论】: