在 Debian 上使用 conda 安装 xgboost

Install xgboost using conda on Debian

当我尝试使用以下命令安装 conda 时 conda install -c aterrel xgboost=0.4.0,出现错误

UnsatisfiableError: The following specifications were found to be in conflict:
  - python 3.5*
  - xgboost 0.4.0*
Use "conda info <package>" to see the dependencies for each package.

命令 conda info xbgoost 给我

NoPackagesFoundError: Package missing in current linux-64 channels: 
  - xgboost

何修复它并安装 xgboost?

从 conda 4.3.5 开始,没有选项可以将通道指定为 conda info。所以要打印包裹的信息,你可以这样做:

(root) ~/condaexpts $ conda config --add channels aterrel                                                                                                                                             
(root) ~/condaexpts $ conda info xgboost                                                                                                                                                              
Fetching package metadata ...........

xgboost 0.4.0.c4fa2f py27_0
---------------------------
file name   : xgboost-0.4.0.c4fa2f-py27_0.tar.bz2
name        : xgboost
version     : 0.4.0.c4fa2f
build string: py27_0
build number: 0
channel     : aterrel
size        : 441 KB
arch        : x86_64
license     : ALv2
md5         : 8f282fc35e18ef443771617459eeb8ad
platform    : linux
requires    : ()
subdir      : linux-64
url         : https://conda.anaconda.org/aterrel/linux-64/xgboost-0.4.0.c4fa2f-py27_0.tar.bz2
dependencies:
    numpy
    python 2.7*
    scikit-learn
    scipy

xgboost 0.4.0 np19py27_0
------------------------
file name   : xgboost-0.4.0-np19py27_0.tar.bz2
name        : xgboost
version     : 0.4.0
build string: np19py27_0
build number: 0
channel     : aterrel
size        : 270 KB
arch        : x86_64
license     : ALv2
md5         : 8dd98afb385109adb42f08337842cc18
platform    : linux
requires    : ()
subdir      : linux-64
url         : https://conda.anaconda.org/aterrel/linux-64/xgboost-0.4.0-np19py27_0.tar.bz2
dependencies:
    numpy 1.9*
    python 2.7*
    scikit-learn
    scipy           

(root) ~/condaexpts $ conda config --remove channels aterrel

您也可以在manifest频道查看相同的信息。

回到您最初的查询,出现了冲突,因为 aterrel's channel 中的包 xgboost 仅针对 python 2.7 而不是针对 python 3.5 构建包名称中的构建字符串 py27 也很明显。

但是,您可以为 python 3.5:

构建它
(root) ~/condaexpts $ wget https://anaconda.org/aterrel/xgboost/0.4.0.c4fa2f/download/linux-64/xgboost-0.4.0.c4fa2f-py27_0.tar.bz2 
(root) ~/condaexpts $ tar -xf xgboost-0.4.0.c4fa2f-py27_0.tar.bz2 -C /tmp/xgboost/
(root) ~/condaexpts $ conda install conda-build -y
(root) ~/condaexpts $ conda-build /tmp/xgboost/info/recipe
(root) ~/condaexpts $ conda install xgboost --use-local -y
Fetching package metadata ...........
Solving package specifications: .

Package plan for installation in environment /home/ubuntu/condaexpts/m3:

The following NEW packages will be INSTALLED:

    xgboost: 0.4.0.c4fa2f-py35_0 local
(root) ~/condaexpts $ python -c 'import xgboost; print(xgboost.__version__)'
0.4

使用 Anaconda 4.4.0 只需输入 conda install py-xgboost