具有GPU支持的XGBoost安装错误:无法复制'xgboost \ lib':不存在或不是常规文件 [英] XGBoost with GPU support installation error: can't copy 'xgboost\lib': doesn't exist or not a regular file

查看:219
本文介绍了具有GPU支持的XGBoost安装错误:无法复制'xgboost \ lib':不存在或不是常规文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

类似的非重复帖子:

我浏览了许多有关在Windows 10上为Python安装xgboost的Stack Overflow帖子,但是没有人提到我遇到的问题.此外,所有文章似乎都是关于在没有GPU支持的情况下安装xgboost的.

I looked around through multiple Stack Overflow posts about installing xgboost for Python on Windows 10, but none of them mentioned the issue I was having. In addition, all the posts seem to be about installing xgboost without GPU support.

我还找到了官方安装指南因为它忽略了某些目录更改,并且具有一些破坏命令流的不同选项,因此很难遵循.以下是我在具有Python 3.6.4的Windows 10上安装具有GPU支持的xgboost的步骤:

I also found the official installation guide to be quite difficult to follow, as it omits certain directory changes and has some different options that disrupt the flow of commands. Below are the steps I used to install xgboost with GPU support on Windows 10 with Python 3.6.4:

第一步是安装此安装所需的以下软件:

The first step is to install the following software that will be required for this installation:

  • CMake ,将CMake添加到系统PATH
  • 带有Update 3和Visual C ++的Visual Studio 2015
  • 适用于Windows的Git ,请确保将其添加到PATH变量
  • CUDA 注意:版本必须至少为8.0.我使用9.0是因为新版本和Tensorflow的兼容性问题
  • CMake, adding CMake to your system PATH
  • Visual Studio 2015 with Update 3 and Visual C++
  • Git for Windows, making sure to add it to the PATH variable
  • CUDA Note: the version must be at least 8.0. I used 9.0 because of compatibility issues with the newer versions and Tensorflow

确保已安装以下软件包:

Ensure the following packages are installed:

conda install -y numpy scipy pandas matplotlib nose scikit-learn graphviz python-graphviz

步骤1:克隆存储库

在VS2015附带的VS2015 x64本机工具命令提示符下,以管理员模式运行以下命令,在您希望xgboost文件夹位于的文件夹中:

Step 1: Cloning the repo

Run the following in the VS2015 x64 Native Tools Command Prompt that comes installed with VS2015 in administrator mode, in the folder you want the xgboost folder to be located in:

git clone --recursive https://github.com/dmlc/xgboost
cd xgboost
git submodule init
git submodule update

步骤2:使用CMake制作.sln文件

mkdir build
cd build
cmake .. -G "Visual Studio 14 2015 Win64" -DUSE_CUDA=ON
cmake --build . --target xgboost --config Release

第3步:安装Python软件包

如果以上步骤完成但没有任何错误,请运行以下命令:

Step 3: Installing the Python Package

If the above complete without any errors, run the following:

cd ../python-package
python setup.py install

错误:

这时,出现以下错误,安装失败:

Error:

At this point, I get the following error and the installation fails:

error: can't copy 'xgboost\lib': doesn't exist or not a regular file

请参阅下面的答案以获取我的解决方案,如果您找到解决此问题的更好方法,请发布另一个答案.

See my answer below for my solution, and please post another answer if you find a better way to solve this problem.

推荐答案

编辑xgboost/python-package/setup.py并将第38行更改为以下内容(

Edit xgboost/python-package/setup.py and change line 38 to the following (source) :

include_package_data=False

现在,它应该已安装,没有任何问题.要查看它们一切正常,只需运行以下命令,如果该命令运行无误,则可以执行以下操作:

Now it should install without any problems. To see that it's all working fine, just run the following command, and if it runs without errors it's good to go:

python -c "import xgboost"

安装后,您可以使用nose软件包并从根xgboost/目录执行以下命令来运行其他测试:

You can run additional tests after installation using the nose package with the following command executed from the root xgboost/ directory:

nosetests tests/python

要进一步确认它已安装了GPU支持,可以使用基准测试脚本随安装一起提供:

To further confirm that it installed with GPU support, you can use the benchmarking scripts that come included with the installation:

gpu_hist算法:

gpu_hist algorithm:

python tests/benchmark/benchmark_tree.py

输出:

Train Time: 46.25219774246216 seconds

没有GPU的历史算法:

hist algorithm without GPU:

python tests/benchmark/benchmark_tree.py --tree_method hist

输出:

Train Time: 84.04853415489197 seconds

这篇关于具有GPU支持的XGBoost安装错误:无法复制'xgboost \ lib':不存在或不是常规文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆