本文介绍了XGBoost安装错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在尝试编译xgboost时遇到错误.我没有sudo访问权限,这使事情变得更加艰难.

I am hitting an error trying to compile xgboost. I do not have sudo access which makes things tougher.

我运行了以下内容:

git clone https://github.com/dmlc/xgboost.git --recursive
cd xgboost
make

这给了我以下错误:

g++ -std=c++0x -Wall -O3 -msse2  -Wno-unknown-pragmas -funroll-loops -Iinclude   -Idmlc-core/include -Irabit/include -fPIC -fopenmp -MM -MT build/learner.o src/learner.cc >build/learner.d
g++ -c -std=c++0x -Wall -O3 -msse2  -Wno-unknown-pragmas -funroll-loops -Iinclude   -Idmlc-core/include -Irabit/include -fPIC -fopenmp src/learner.cc -o build/learner.o
In file included from dmlc-core/include/dmlc/logging.h:15,
                 from include/xgboost/logging.h:11,
                 from src/learner.cc:7:
dmlc-core/include/dmlc/./base.h:71: note: #pragma message: Will need g++-4.6 or higher to compile allthe features in dmlc-core, compile without c++0x, some features may be disabled
In file included from include/xgboost/./gbm.h:18,
                 from include/xgboost/learner.h:16,
                 from src/learner.cc:8:
include/xgboost/././data.h: In constructor ‘xgboost::DMatrix::DMatrix()’:
include/xgboost/././data.h:234: error: ‘nullptr’ was not declared in this scope
In file included from include/xgboost/learner.h:16,
                 from src/learner.cc:8:
include/xgboost/./gbm.h: At global scope:
include/xgboost/./gbm.h:72: error: ‘nullptr’ was not declared in this scope
In file included from src/learner.cc:17:
src/./common/io.h:30: error: expected ‘;’ before ‘override’
src/learner.cc:496: error: expected ‘;’ at end of input
src/learner.cc:496: error: expected ‘}’ at end of input
In file included from src/learner.cc:17:
src/./common/io.h: In constructor ‘xgboost::common::PeekableInStream::PeekableInStream(dmlc::Stream*)’:
src/./common/io.h:28: error: class ‘xgboost::common::PeekableInStream’ does not have any field named ‘strm_’
src/./common/io.h:28: error: class ‘xgboost::common::PeekableInStream’ does not have any field named ‘buffer_ptr_’
src/./common/io.h: At global scope:
src/./common/io.h:28: error: expected unqualified-id at end of input
src/./common/io.h:28: error: expected ‘}’ at end of input
src/./common/io.h:28: error: expected ‘}’ at end of input
make: *** [build/learner.o] Error 1

推荐答案

您可以按如下方式安装xgboost库以及其他基本库(请根据适合您项目的库进行选择),我在此答案中的主要重点是使它对于设置大多数需要sklearn,pandas,scipy和xgboost算法以及可视化库的数据科学项目很有帮助.

You can install xgboost library along with other essential libraries as follows(please choose based on the libraries sufficient for your project), my main focus in this answer is to make it helpful in setting up for most data science projects requiring sklearn, pandas, scipy and xgboost algorithms along with visualization libraries.

# installing essentials
apt-get update; \
apt-get install -y \
  python python-pip \
  build-essential \
  python-dev \
  python-setuptools \
  python-matplotlib \
  libatlas-dev \
  curl \
  libatlas3gf-base && \
  apt-get clean

# upgrading pip
curl -O https://bootstrap.pypa.io/get-pip.py && \
python get-pip.py && \
rm get-pip.py
# installing libraries
pip install numpy==1.13.1
pip install scipy
pip install -U scikit-learn
pip install seaborn
pip install --pre xgboost

如果您仍然遇到环境问题,建议您使用 Dockerfile .您可能还会发现Datmo转换对实现这一点很有帮助.

If you're still having environment issues I would suggest using this Dockerfile. You might also find Datmo conversion useful to facilitate this.

免责声明:我在这家名为 Datmo 的公司工作,该公司通过简化机器学习来建立开发人员社区工作流程.

DISCLAIMER: I work at this company called Datmo, which is building a community of developers by simplifying the machine learning workflow.

这篇关于XGBoost安装错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-16 18:02