简体   繁体   中英

How to install Python XGBoost package in virtualenv on mac

I have been trying to install Python 2.7 XGBoost on my mac. I am running a framework build of python via brew and trying to install into a virtualenv. I have tried the following methods:

  1. Manual build found here: https://github.com/dmlc/xgboost/blob/master/doc/build.md#python-package-installation

This results in this error:

error: Error: setup script specifies an absolute path:

/Users/username/git/xgboost/python-package/xgboost/../../lib/libxgboost.so

setup() arguments must *always* be /-separated paths relative to the
setup.py directory, *never* absolute paths.

I was able to build xgboost, but I cant install the package. The docs discuss needing disutils , but I can't find it anywhere. I tried running on disutils2 , but that didn't work.

  1. pip install found here: https://pypi.python.org/pypi/xgboost/

This results in this error:

Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/jj/7r79983d7jvcz_1y6w2n5v2m0000gn/T/pip-build-l4ak5P/xgboost/

Removing "include_package_data=True" from setup.py helps. See: https://github.com/django-salesforce/django-salesforce/issues/19

In python-package folder,

  1. modify include_package_data=False in setup.py, and python setup.py install;
  2. run: sudo cp ./xgboost/VERSION you_python_lib_location /site-packages/ you_xgboost_version.egg /xgboost/

In my computer, you_python_lib_location is /Users/LeonTao/anaconda2/lib/python2.7 and you_xgboost_version.egg is xgboost-0.6-py2.7.egg. So I run:

sudo cp ./xgboost/VERSION /Users/LeonTao/anaconda2/lib/python2.7/site-packages/xgboost-0.6-py2.7.egg/xgboost/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM