【问题标题】:Install xgboost under python with 32-bit msys failing在 32 位 msys 失败的情况下在 python 下安装 xgboost
【发布时间】:2015-11-22 08:56:09
【问题描述】:

尝试安装 xgboost 失败..? 该版本是 Windows 和企业版的 Anaconda 2.1.0(64 位)。 我该如何进行?我一直在使用 R,从 RStudio 在 R 中安装新软件包似乎很容易,但在 spyder 中却不是这样,因为我需要转到命令窗口来执行它,然后在这种情况下它会失败..

import sys

print (sys.version) 
2.7.8 |Anaconda 2.1.0 (64-bit)| (default, Jul  2 2014, 15:12:11) [MSC v.1500 64 bit (AMD64)]

C:\anaconda\Lib\site-packages>pip install -U xgboost
Downloading/unpacking xgboost
  Could not find a version that satisfies the requirement xgboost (from versions: 0.4a12, 0.4a13)
Cleaning up...
No distributions matching the version for xgboost
Storing debug log for failure in C:\Users\c_kazum\pip\pip.log


------------------------------------------------------------
C:\Users\c_kazum\AppData\Local\Continuum\Anaconda\Scripts\pip-script.py run on 08/27/15 12:52:30
Downloading/unpacking xgboost
  Getting page https://pypi.python.org/simple/xgboost/
  URLs to search for versions for xgboost:
  * https://pypi.python.org/simple/xgboost/
  Analyzing links from page https://pypi.python.org/simple/xgboost/
    Found link https://pypi.python.org/packages/source/x/xgboost/xgboost-0.4a12.tar.gz#md5=4d768e034a28590497bb79279f036946 (from https://pypi.python.org/simple/xgboost/), version: 0.4a12
    Found link https://pypi.python.org/packages/source/x/xgboost/xgboost-0.4a13.tar.gz#md5=5f53d51e4305c679192b3cabda2b0dbe (from https://pypi.python.org/simple/xgboost/), version: 0.4a13
  Ignoring link https://pypi.python.org/packages/source/x/xgboost/xgboost-0.4a12.tar.gz#md5=4d768e034a28590497bb79279f036946 (from https://pypi.python.org/simple/xgboost/), version 0.4a12 is a pre-release (use --pre to allow).
  Ignoring link https://pypi.python.org/packages/source/x/xgboost/xgboost-0.4a13.tar.gz#md5=5f53d51e4305c679192b3cabda2b0dbe (from https://pypi.python.org/simple/xgboost/), version 0.4a13 is a pre-release (use --pre to allow).
  Could not find a version that satisfies the requirement xgboost (from versions: 0.4a12, 0.4a13)
Cleaning up...
  Removing temporary dir c:\users\c_kazum\appdata\local\temp\pip_build_c_kazum...
No distributions matching the version for xgboost
Exception information:
Traceback (most recent call last):
  File "C:\Users\c_kazum\AppData\Local\Continuum\Anaconda\lib\site-packages\pip\basecommand.py", line 122, in main
    status = self.run(options, args)
  File "C:\Users\c_kazum\AppData\Local\Continuum\Anaconda\lib\site-packages\pip\commands\install.py", line 278, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "C:\Users\c_kazum\AppData\Local\Continuum\Anaconda\lib\site-packages\pip\req.py", line 1177, in prepare_files
    url = finder.find_requirement(req_to_install, upgrade=self.upgrade)
  File "C:\Users\c_kazum\AppData\Local\Continuum\Anaconda\lib\site-packages\pip\index.py", line 322, in find_requirement
    raise DistributionNotFound('No distributions matching the version for %s' % req)
DistributionNotFound: No distributions matching the version for xgboost

【问题讨论】:

标签: python package failed-installation msys xgboost


【解决方案1】:

我回答有点晚了,但我仍然会继续为仍然有安装问题的任何人回答。我按照中列出的步骤 https://www.kaggle.com/c/otto-group-product-classification-challenge/forums/t/13043/run-xgboost-from-windows-and-python 他们是https://github.com/dmlc/xgboost/tree/master/windows 上这些步骤的简明版本。我将在下面总结我所做的。

1) 下载 Visual Basic Studio。您可以在 Visual Studio 网站上下载社区版。右上角有一个“免费的visual studio按钮”

2) 从 xgboost/tree/master/windows 的 git hub 存储库中复制所有内容并在 Visual Studio 上打开 Visual Studio 现有项目

3) 您需要选择几个下拉菜单(“Release”和“X64”,然后从上方菜单中选择 build --> build all。它应该类似于随附的屏幕截图。

4) 如果你看到消息 ========== Build: 3 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========,那就是都很好

5) 浏览到 XGB 安装文件所在的 python-packages 文件夹并运行安装命令“python setup.py install”。

希望这会有所帮助。

【讨论】:

  • 一般来说,只有链接的答案是不受欢迎的。最好总结链接中的内容,以防链接因内容更改而死亡。
【解决方案2】:

这是一个 xgboost 问题,而不是您最初标记的 Anaconda 问题(我不使用 Anaconda,但我也有这个)。

编辑:根据您的更新,您的损坏是由路径上某处的 32 位 msys 引起的,而您安装的是 64 位 Python。自 8 月 25 日以来,我和所有其他人报告的损坏是 0.4a12/3 预发行版:


原始答案 - 基于您提供的有限信息(此处,与 Kaggle 线程相反)并且没有详细的失败日志: 显然latest versions of xgboost on pypi, 0.4a12 and 0.4a13 都是预发布版本,默认情况下 pip 不会使用它,除非您使用 pip install --pre xgboost

我通过挖掘pip install -v xgboost 发现了这一切,它显示了有关尝试安装失败原因的有用详细信息(如下);然后使用pip helppip install -h 查看所有安装选项:

pip install -v xgboost Downloading/unpacking xgboost   Ignoring link
https://pypi.python.org/packages/source/x/xgboost/xgboost-0.4a12.tar.gz#md5=4d768e034a28590497bb79279f036946
(from https://pypi.python.org/simple/xgboost/), version 0.4a12 is a
pre-release (use --pre to allow).   Ignoring link
https://pypi.python.org/packages/source/x/xgboost/xgboost-0.4a13.tar.gz#md5=5f53d51e4305c679192b3cabda2b0dbe
(from https://pypi.python.org/simple/xgboost/), version 0.4a13 is a
pre-release (use --pre to allow).

然后pip install -h 告诉你:

Install Options:
  -e, --editable <path/url>   Install a project in editable mode ...
  ...
  --pre                       Include pre-release and development versions. By default, pip only finds stable versions.

最后:

pip install --pre xgboost

(PS xgboost 维护者发a recent change in Aug 2015

【讨论】:

  • 我使用 pip install --pre xgboost 但仍然没有运气,我收到类似于此线程的错误。 kaggle.com/c/…
  • 我说的是 pip install -v xgboost 查看详细的失败原因,然后将其发布作为您问题的一部分。了解失败的确切原因应该可以解决/帮助解决您的问题。
  • 感谢您的回复。这是使用 pip install -v xgboost 的屏幕转储
  • 屏幕转储太大,无法在评论框中添加...?但是,我按照以下链接上的说明在窗口框上构建包,它可以工作!!! kaggle.com/c/…
  • 好的,根本原因是您的 MinGW/msys 副本是 32 位而不是 64 位。然而,关于解决方案,该线程仍不清楚。请详细说明解决方案并将其发布在此处作为您自己问题的答案。
【解决方案3】:

这解决了我的问题

$ sudo apt-get install gcc-5
$ env CC=gcc CXX=g++
$ pip install xgboost

【讨论】:

    【解决方案4】:

    终于对我有用(Mac OS) 在命令提示符下按照以下步骤操作:

    1. 在“/bin......install.sh)”下运行整个命令

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

    注意:检查上面的命令(https://brew.sh/

    1. brew 安装 libomp

    2. pip3 安装 xgboost

    【讨论】:

      猜你喜欢
      • 2016-01-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-01-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多