Missing GOMP_parallel or GOMP_4.0 in (Docker) jupyter/all-spark-notebook: both R and Python

匿名 (未验证) 提交于 2019-12-03 09:02:45

问题:

I have a question regarding GOMP, that I figured is related to gcc.

I am using this image as a base for some experiments. It seems that I am using an alright version (4.9.2) based on this unmodified image, but I get some strange behaviour with a number of Cython related packages.

Example 1

When running this on the unmodified jupyter/all-spark-notebook docker image, when attempting to run Python I get the following issue,

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

Things I have tried:

  1. Going to the file lightfm.py and moving all of the dependencies onto one line like so:

    from .lightfm_fast import (CSRMatrix, FastLightFM, fit_logistic, predict_lightfm, fit_warp, fit_bpr, fit_warp_kos)

to

from .lightfm_fast import (CSRMatrix, FastLightFM, fit_logistic, predict_lightfm, fit_warp, fit_bpr, fit_warp_kos).

Same error.

Also tried ".lightfm" to "lightfm" to change from relative import. Same error.

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

But I think if you just pull the docker image and do a pip install lightfm it should replicate the error precisely.

Example 2

When running pip install xgboost, the installation succeeds, but when in notebook I attempt to do:

--------------------------------------------------------------------------- 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)

I have just noticed that this is a recurring pattern and at times can be quite limiting, but I don't understand compilers that well to know if this actually a problem with the image or if that's not really an 'issue', but rather a design decision. Any ideas?

Much appreciated!

Things I have tried:

  1. I tried conda install -c https://conda.anaconda.org/anaconda gcc in the terminal but to no avail.

  2. Also when I tried to do install.packages('xgboost') (equivalent) in R, I got this error:

    Error : .onLoad failed in loadNamespace() for 'xgboost', details: call: dyn.load(file, DLLpath = DLLpath, ...) error: unable to load shared object '/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 also did not help me as it was already installed.

  1. Upon suggestion of someone from project Jupyter I ran conda list and found this line: libgcc 4.8.5 1 r

But no gcc I also have glib. But in terminal:

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 

UPDATE: I now think that the detected compiler is actually an earlier version, so perhaps that is the source of the problem, because upon running

%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

I get the following response:

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   : 

Any other thoughts?

回答1:

Most probably author did already find the answer, however I will still leave it here as it may potentially save time for someone.

The issue is indeed related to the wrong version of gcc used. Running this command before installing xgboost on top of all-spark-notebook helped me to fix the gomp issue:

RUN conda install -y gcc

You can see the working solution in my extension of all-spark-notebook on github.



易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!