【问题标题】:OSError when trying to run XGBoost on Jupyter Notebook尝试在 Jupyter Notebook 上运行 XGBoost 时出现 OSError
【发布时间】:2017-11-09 10:58:29
【问题描述】:

我通过 pip 安装了 xgboost,并试图在 Jupyter Notebook 上运行它。 但是,运行时

from xgboost import XGBClassifier

在 Python 3 jupyter notebook 上,我收到以下错误:

OSError: /home/martin/anaconda3/bin/../lib/libgomp.so.1: version GOMP_4.0' not found (required by /home/martin/anaconda3/lib/python3.6/site-packages/xgboost/./lib/libxgboost.so)

我该怎么办?

【问题讨论】:

  • 更新:我得到了github.com/dmlc/xgboost/issues/1786的帮助
  • 问题是,现在我收到以下错误:OSError: /home/martin/anaconda3/lib/python3.6/site-packages/zmq/backend/cython/../.. /../../.././libstdc++.so.6:找不到版本“GLIBCXX_3.4.20”(/home/martin/anaconda3/lib/python3.6/site-packages/xgboost/./ 需要lib/libxgboost.so)

标签: python jupyter-notebook xgboost


【解决方案1】:

解决了。再次,在https://github.com/dmlc/xgboost/issues/1786找到解决方案

为了让 GOMP_4.0 工作,请按照以下步骤操作:

1) 在终端上输入以下内容(用自己的路径替换)

strings /home/martin/anaconda3/bin/../lib/libgomp.so.1 |grep GOMP

你会得到一个列表,GOMP_4.0 很可能不在那里(如果是的话,我认为这不会起作用,因为那不是问题)

2) 输入

sudo find / -name libgomp.so.1*

您将获得地址列表。对每一个重复步骤 1 (strings <path> |grep GOMP),直到找到包含 GOMP_40 的一个(在我的情况下,/usr/lib/x86_64-linux-gnu/libgomp.so.1

3) 现在输入以下内容,首先输入您的原始路径,然后输入包含 GOMP_4.0 的路径

sudo rm -rf <path in anaconda>
sudo ln -s <path with GOMP_4.0> <path in anaconda>

例如:

sudo rm -rf /home/martin/anaconda3/bin/../lib/libgomp.so.1
sudo ln -s /usr/lib/x86_64-linux-gnu/libgomp.so.1 /home/martin/anaconda3/bin/../lib/libgomp.so.1

这应该可以解决问题。但是,在此之后,我遇到了类似的错误:

操作系统错误:/home/martin/anaconda3/lib/python3.6/site-packages/zmq/backe‌​nd/cython/../../../.‌​./.././libstdc++ .so.‌​6:找不到版本“GLIBCXX_3.4.20”(/home/martin/anaconda3/lib/python3.6/site-packages/xgboost/.‌​/lib/libxgboost.so 需要)

我用同样的方法解决了这个问题,只是这次在步骤 1) 中使用 |grep GLIBCXX,在步骤 2) 中使用 sudo find / -name libgomp.so.1*,这次寻找 GLIBCXX_3.4.20。

【讨论】:

    猜你喜欢
    • 2019-06-11
    • 2020-06-08
    • 2022-10-07
    • 1970-01-01
    • 1970-01-01
    • 2021-04-26
    • 1970-01-01
    • 2017-12-16
    • 2017-11-25
    相关资源
    最近更新 更多