13

我有一个使用 xgboost 的项目。我们现在将项目转移到容器中。但是使用 pip 安装后,它会抛出以下错误:

Traceback (most recent call last):
  File "restart_db.py", line 5, in <module>
    from autoai.core.providers import GlobalEnrichmentProvider
  File "/volumes/code/autoai/core/providers/__init__.py", line 1, in <module>
    from .files_providers import CsvProvider, TsvProvider, ExcelProvider, FileProvider
  File "/volumes/code/autoai/core/providers/files_providers.py", line 10, in <module>
    from .base import BaseProvider, BaseInMemoryProvider
  File "/volumes/code/autoai/core/providers/base.py", line 1, in <module>
    from autoai.models.dataset_connection import JoinTypes
  File "/volumes/code/autoai/models/__init__.py", line 5, in <module>
    from .classifier import Classifier
  File "/volumes/code/autoai/models/classifier.py", line 8, in <module>
    from eli5 import explain_prediction
  File "/volumes/dependencies/lib/python3.6/site-packages/eli5/__init__.py", line 53, in <module>
    from .xgboost import (
  File "/volumes/dependencies/lib/python3.6/site-packages/eli5/xgboost.py", line 9, in <module>
    from xgboost import (  # type: ignore
  File "/volumes/dependencies/lib/python3.6/site-packages/xgboost/__init__.py", line 11, in <module>
    from .core import DMatrix, Booster
  File "/volumes/dependencies/lib/python3.6/site-packages/xgboost/core.py", line 150, in <module>
    _LIB = _load_lib()
  File "/volumes/dependencies/lib/python3.6/site-packages/xgboost/core.py", line 141, in _load_lib
    'Error message(s): {}\n'.format(os_error_list))
xgboost.core.XGBoostError: XGBoost Library (libxgboost.so) could not be loaded.
Likely causes:
  * OpenMP runtime is not installed (vcomp140.dll or libgomp-1.dll for Windows, libgomp.so for UNIX-like OSes)
  * You are running 32-bit Python on a 64-bit OS
Error message(s): ['libgomp.so.1: cannot open shared object file: No such file or directory']

我检查了我的 python 和我的 ubuntu 都是 64 位的,然后运行: apt-get update && apt-get install -y libaio1

为了确保该包在那里(我在某处读到这可能是问题所在) - 但它仍然会引发相同的错误。

我已经坚持了一段时间了,将不胜感激任何帮助。

4

4 回答 4

4

我遇到了同样的错误lightGBM,为了解决我运行的问题:

apt-get install libgomp1 

lightGBM在调用任何代码之前,这是必需的。对我来说,这个错误发生在解开lightGBM模型时,而不是特别是在导入lightGBM.

于 2019-03-07T05:04:29.590 回答
4

我在创建项目的 Docker 映像时遇到了这个问题。

我使用了以下命令:

RUN apt-get update && \

     apt-get -y --no-install-recommends install \

     libgomp1
于 2020-02-19T11:47:50.900 回答
1

我有同样的问题。试图解决这两个“可能”的原因都无济于事。奇怪的是,就在几天前,一切都运行良好。我将 Python 版本从 3.6.1 更改为 3.6.7,它解决了这个问题。不幸的是,我还不知道问题出在哪里,但它为我解决了这个问题。

这是 CircleCi 的 linux 机器上 Python 的 docker 镜像。指定它以防问题与它有关。

希望这对某人有帮助!

于 2019-12-17T01:45:23.177 回答
1

在我的 MacOS 上得到了这个,正如调试消息所暗示的,brew install libomp修复了它。

于 2020-08-07T08:43:19.183 回答