ubuntu 安装xgboost

Ubuntu 安装xgboost

1、 安装gcc ,g++

Sudo apt-get install gcc g++

遇到问题:

E: Could not open lock file /var/lib/dpkg/lock - open (13 Resource temporarily unavailable)

E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it?

分两种情况:

先看到底有没开两个apt,如果确定没开两个APT-GET,请sudo rm /var/lib/dpkg/lock,这样就删除了锁文件,然后运行sudo dpkg --configure -a重新配置。 问题解决。

2、 下载xgboost安装

Cd xgboost*

Make –j4

#遇到问题:

error:Error:setup script specifies an absolute path:

/home/llp/Desktop/xgboost-master/python-package/xgboost/../../wrapper/libxgboostwrapper.so

解决办法

修改setup.py中

include_package_data=False, (原来是True)

再次运行python3 setup.py install 即可

系统显示是正常安装了。

3、 验证是否安装成功

>>> import xgboost

继续报错

xgboost OSError:../lib/libgomp.so.1:version ‘GOMP_4.0’ not found(required by ../xgboost/../../wrapper/libxgboostwrapper.so)

4、 删除安装的xgboost

Cd /home/llp/anaconda3/lib/python3.5/site-packages

Rm –rf xgboost*

5、 重新安装xgboost,安装一些依赖包

http://blog.csdn.net/tobeyourlover/article/details/53244421

显示安装成功!!

继续报错

xgboost OSError:../lib/libgomp.so.1:version ‘GOMP_4.0’ not found(required by ../xgboost/../../wrapper/libxgboostwrapper.so)

但是,在安装成功的信息显示表明,xgboost是安装在系统默认的python2.7版本中,但是anaconda中使用的是3.5版本的python。原来安装的是python2.7版本的xgboost。

6、 删除所有xgboost*的相关目录,重新安装:

Pip install xgboost

依旧报错:

https://github.com/dmlc/xgboost/issues/820

"/home/ashish/anaconda2/bin/../lib/libgomp.so.1: version `GOMP_4.0' not found (required by /home/ashish/anaconda2/lib/python2.7/site-packages/xgboost/./lib/libxgboost.so)"

解决方法:

https://github.com/dmlc/xgboost/issues/1786

tep 1 : use the following commands to check whether the libgomp.so.1 file in anconda contains the required version GOMP_4.0 (replace the path by your own in all the steps) :

string /home/yin/anaconda3/bin/../lib/libgomp.so.1 |grep GOMP ( if there is not GOMP_4.0 version ,go to step 2, else leave a comment )

step 2: to check libgomp.so.1 in your OS:

sudo find / -name libgomp.so.1*

step3: check the link in anaconda :

ls -al /home/yin/anaconda3/bin/../lib/libgomp.so.1 if the link not link to the newest verison in step 2 's list , then make a new link to update it by:

sudo rm -rf /home/yin/anaconda3/bin/../lib/libgomp.so.1

sudo ln -s <path of the newest version libgomp file in your OS > <path in anaconda>

【在/usr/lib/x86*/目录下找到一个更新的libgomp-1.0.so.0.1.0,将其拷贝到anaconda3的lib目录下。按照上面说的删除旧的软链接,建立新的软链接,注意:libgomp.so.1和libgomp.so都需要进行这样的操作】

若继续报错,缺少其它类似这样的文件,还是用此方法解决。