我有一个关于 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 并将所有依赖项移动到一行中,如下所示:
从 .lightfm_fast 导入(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')
(等效)时,我收到此错误:错误:.onLoad 在“xgboost”的 loadNamespace() 中失败,详细信息: 调用: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: undefined symbol: GOMP_parallel
sudo apt-get install libgomp1
也没有帮助我,因为它已经安装了。
- 根据 Jupyter I 项目的某人的建议
运行
conda list
并找到这一行:libgcc 4.8.5 1r
但是没有 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 :
还有其他想法吗?
最佳答案
很可能作者已经找到了答案,但我仍然会把它留在这里,因为它可能会为某些人节省时间。
问题确实与使用的gcc版本错误有关。在 all-spark-notebook
上安装 xgboost 之前运行此命令帮助我解决了 gomp 问题:
RUN conda install -y gcc
您可以在我的 all-spark-notebook
扩展中看到工作解决方案 github .
关于python - (Docker) jupyter/all-spark-notebook : both R and Python 中缺少 GOMP_parallel 或 GOMP_4.0,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36472058/