Python xgboost与anaconda的安装问题

Python xgboost与anaconda的安装问题,python,installation,anaconda,xgboost,Python,Installation,Anaconda,Xgboost,我用的是蟒蛇。我首先切换到Python2(版本2.7.11) 我使用以下命令在anaconda中安装xgboost conda install -c https://conda.anaconda.org/akode xgboost 然后我检查了xgboost是否已安装 conda list xgboost 0.3 py27_0 akode 我在terminal中运行python,导入xgboost并得到以下错

我用的是蟒蛇。我首先切换到Python2(版本2.7.11)

我使用以下命令在anaconda中安装xgboost

conda install -c https://conda.anaconda.org/akode xgboost
然后我检查了xgboost是否已安装

conda list
xgboost                   0.3                      py27_0    akode
我在terminal中运行python,导入xgboost并得到以下错误

import xgboost as xgb

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "//anaconda/envs/wen2/lib/python2.7/site-packages/xgboost.py", line 82, in <module>
    xglib = load_xglib()
  File "//anaconda/envs/wen2/lib/python2.7/site-packages/xgboost.py", line 59, in load_xglib
    lib = ctypes.cdll.LoadLibrary(lib_path[0])
  File "//anaconda/envs/wen2/lib/python2.7/ctypes/__init__.py", line 443, in LoadLibrary
    return self._dlltype(name)
  File "//anaconda/envs/wen2/lib/python2.7/ctypes/__init__.py", line 365, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: dlopen(//anaconda/envs/wen2/lib/python2.7/site-packages/libxgboostwrapper.so, 6): Library not loaded: @rpath/./libgomp.1.dylib
  Referenced from: //anaconda/envs/wen2/lib/python2.7/site-packages/libxgboostwrapper.so
  Reason: image not found
将xgboost导入为xgb
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
文件“//anaconda/envs/wen2/lib/python2.7/site packages/xgboost.py”,第82行,在
xglib=load_xglib()
文件“//anaconda/envs/wen2/lib/python2.7/site packages/xgboost.py”,第59行,在load\u xglib中
lib=ctypes.cdll.LoadLibrary(lib_路径[0])
LoadLibrary中的文件“//anaconda/envs/wen2/lib/python2.7/ctypes/_init__;.py”,第443行
返回自我类型(名称)
文件“//anaconda/envs/wen2/lib/python2.7/ctypes/_init__.py”,第365行,在_init中__
self.\u handle=\u dlopen(self.\u名称,模式)
OSError:dlopen(//anaconda/envs/wen2/lib/python2.7/site-packages/libxgboostwrapper.so,6):未加载库:@rpath//libgomp.1.dylib
参考自:://anaconda/envs/wen2/lib/python2.7/site-packages/libxgboostwrapper.so
原因:找不到图像
我不知道下一步该怎么办。

你试过使用pip吗?
源代码激活您的环境


pip安装xgboost

首先需要通过“make”构建库,然后可以使用anaconda提示符进行安装

首先按照官方指南执行以下步骤(在Windows上的Git Bash中):

最后,使用anaconda提示符执行以下操作:

cd xgboost\python-package  
python setup.py install 
也可以参考这些重要资源:


您下载的软件包映像已损坏。 你应该做什么:

首先移除xgboost软件包(在终端中):

康达拆卸xgboost

然后在安装时使用其他软件包重新安装 所以只要写下:

康达安装py xgboost

然后,您可以在python控制台中检查安装:

导入xgboost


应该没问题。

我也有类似的问题

>>> import xgboost
/usr/local/anaconda2/lib/python2.7/site-packages/sklearn/cross_validation.py:44: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the refactored classes and functions are moved. Also note that the interface of the new CV iterators are different from that of this module. This module will be removed in 0.20.
  "This module will be removed in 0.20.", DeprecationWarning)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/anaconda2/lib/python2.7/site-packages/xgboost/__init__.py", line 11, in <module>
    from .core import DMatrix, Booster
  File "/usr/local/anaconda2/lib/python2.7/site-packages/xgboost/core.py", line 112, in <module>
    _LIB = _load_lib()
  File "/usr/local/anaconda2/lib/python2.7/site-packages/xgboost/core.py", line 106, in _load_lib
    lib = ctypes.cdll.LoadLibrary(lib_path[0])
  File "/usr/local/anaconda2/lib/python2.7/ctypes/__init__.py", line 440, in LoadLibrary
    return self._dlltype(name)
  File "/usr/local/anaconda2/lib/python2.7/ctypes/__init__.py", line 362, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: /usr/local/anaconda2/bin/../lib/libgomp.so.1: version `GOMP_4.0' not found (required by /usr/local/anaconda2/lib/python2.7/site-packages/xgboost/./lib/libxgboost.so)

希望这能有所帮助

在我的ubuntu 14.04中,
第一:安装anaconda
第二:git克隆xgboost,制作并安装python包
第三:用蟒蛇设置xgboost。例如:
1) cdyourpath/xgboost/python包 2) 找到蟒蛇路径:

anaconda/bin/python setup.py安装
我也遇到了同样的错误。我完全卸载了pip unistall的xgboost。然后通过以下方式重新安装:

conda install -c bioconda xgboost=0.6a2
这似乎解决了问题

未加载库:@rpath//libgomp.1.dylib

这是关键

在我的例子中,它是“未加载库:/usr/local/opt/gcc/lib/gcc/6/libgomp.1.dylib”

我检查路径“/usr/local/opt/gcc/lib/gcc” 那里只有一个名为7的文件夹,没有6。
因此,我使用“sudo find/-name libgomp.1.dylib”查找我安装的所有gcc版本,我发现在另一个位置有一个版本6。
然后在“/usr/local/opt/gcc/lib/gcc”下创建一个名为6的文件夹,并将这些GCC6文件复制到其中。
最后,“导入xgboost”可以正常工作。

看起来这将安装过时的xgboost,以及sklearn版本0.16.1(过时)。这对我不起作用。我的python版本是3.5.2,我得到的错误是:
bash-4.3$python-V python 3.5.2::Anaconda 4.2.0(x86_64)(/Users/xxx/Anaconda)bash-4.3$conda安装-c aterrel xgboost获取包元数据。。。。。。。。。解决包规格:。。。。不可满足错误:发现以下规范存在冲突:-python 3.5*-xgboost使用“conda info”查看每个包的依赖项
Ok您现在应该做的就是
conda安装py xgboost
,因为0.4.0是xgboost的旧版本谢谢,您的建议对我有用。您知道您的命令中的
bioconda
是什么意思吗?
cd xgboost\python-package  
python setup.py install 
>>> import xgboost
/usr/local/anaconda2/lib/python2.7/site-packages/sklearn/cross_validation.py:44: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the refactored classes and functions are moved. Also note that the interface of the new CV iterators are different from that of this module. This module will be removed in 0.20.
  "This module will be removed in 0.20.", DeprecationWarning)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/anaconda2/lib/python2.7/site-packages/xgboost/__init__.py", line 11, in <module>
    from .core import DMatrix, Booster
  File "/usr/local/anaconda2/lib/python2.7/site-packages/xgboost/core.py", line 112, in <module>
    _LIB = _load_lib()
  File "/usr/local/anaconda2/lib/python2.7/site-packages/xgboost/core.py", line 106, in _load_lib
    lib = ctypes.cdll.LoadLibrary(lib_path[0])
  File "/usr/local/anaconda2/lib/python2.7/ctypes/__init__.py", line 440, in LoadLibrary
    return self._dlltype(name)
  File "/usr/local/anaconda2/lib/python2.7/ctypes/__init__.py", line 362, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: /usr/local/anaconda2/bin/../lib/libgomp.so.1: version `GOMP_4.0' not found (required by /usr/local/anaconda2/lib/python2.7/site-packages/xgboost/./lib/libxgboost.so)
sudo su
pip uninstall xgboost
pip install xgboost
python
>>> import xgboost
/usr/local/anaconda2/lib/python2.7/site-packages/sklearn/cross_validation.py:44: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the refactored classes and functions are moved. Also note that the interface of the new CV iterators are different from that of this module. This module will be removed in 0.20.
  "This module will be removed in 0.20.", DeprecationWarning)
>>> ~
conda install -c bioconda xgboost=0.6a2