Reputation: 8262
Similar non-duplicate posts:
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.
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:
PATH
PATH
variableEnsure the following packages are installed:
conda install -y numpy scipy pandas matplotlib nose scikit-learn graphviz python-graphviz
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
mkdir build
cd build
cmake .. -G "Visual Studio 14 2015 Win64" -DUSE_CUDA=ON
cmake --build . --target xgboost --config Release
If the above complete without any errors, run the following:
cd ../python-package
python setup.py install
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.
Upvotes: 0
Views: 1693
Reputation: 8262
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"
You can run additional tests after installation using the nose
package with the following command executed from the root xgboost/
directory:
nosetests tests/python
To further confirm that it installed with GPU support, you can use the benchmarking scripts that come included with the installation:
gpu_hist algorithm:
python tests/benchmark/benchmark_tree.py
Output:
Train Time: 46.25219774246216 seconds
hist algorithm without GPU:
python tests/benchmark/benchmark_tree.py --tree_method hist
Output:
Train Time: 84.04853415489197 seconds
Upvotes: 1