[英]How to install xgboost python wrapper in macOS virtualenv properly?
Under virtualenv, I'm trying to install python wrapper using official installation guide . 在virtualenv下,我尝试使用官方安装指南安装python wrapper。 When I did
当我做的时候
sudo python setup.py install
I got errors: 我有错误:
Install libxgboost from: ['/Users/dmitry/dev/mlenv/xgboost/xgboost/python-package/xgboost/../../lib/libxgboost.so']
running install
running bdist_egg
running egg_info
creating xgboost.egg-info
writing xgboost.egg-info/PKG-INFO
writing dependency_links to xgboost.egg-info/dependency_links.txt
writing requirements to xgboost.egg-info/requires.txt
writing top-level names to xgboost.egg-info/top_level.txt
writing manifest file 'xgboost.egg-info/SOURCES.txt'
reading manifest file 'xgboost.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching '*' under directory 'xgboost/include'
warning: no files found matching '*' under directory 'xgboost/src'
warning: no files found matching '*' under directory 'xgboost/make'
warning: no files found matching '*' under directory 'xgboost/rabit'
warning: no files found matching '*' under directory 'xgboost/lib'
warning: no files found matching '*' under directory 'xgboost/dmlc-core'
warning: no previously-included files matching '*.o' found anywhere in distribution
warning: no previously-included files matching '*.a' found anywhere in distribution
warning: no previously-included files matching '*.pyo' found anywhere in distribution
warning: no previously-included files matching '*.pyc' found anywhere in distribution
writing manifest file 'xgboost.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.12-x86_64/egg
running install_lib
running build_py
creating build
creating build/lib
creating build/lib/xgboost
copying xgboost/__init__.py -> build/lib/xgboost
copying xgboost/callback.py -> build/lib/xgboost
copying xgboost/compat.py -> build/lib/xgboost
copying xgboost/core.py -> build/lib/xgboost
copying xgboost/libpath.py -> build/lib/xgboost
copying xgboost/plotting.py -> build/lib/xgboost
copying xgboost/rabit.py -> build/lib/xgboost
copying xgboost/sklearn.py -> build/lib/xgboost
copying xgboost/training.py -> build/lib/xgboost
error: Error: setup script specifies an absolute path:
/Users/dmitry/dev/mlenv/xgboost/xgboost/python-package/xgboost/../../lib/libxgboost.so
setup() arguments must *always* be /-separated paths relative to the
setup.py directory, *never* absolute paths.
In this post https://stackoverflow.com/a/41061466 , the guy advised remove "include_package_data=True"
from setup.py
. 在此帖子https://stackoverflow.com/a/41061466中 ,该人员建议从
setup.py
删除"include_package_data=True"
。 I did that, then xgboost has been successfully installed, ie python -c "import xgboost; print(xgboost.__version__)"
outputs 0.6. 我这样做了,然后xgboost已成功安装,即
python -c "import xgboost; print(xgboost.__version__)"
输出0.6。
Nevertheless, when I execute it in folder that is different from xgboost_root_dir/python-package/
, I get: 不过,当我在不同于
xgboost_root_dir/python-package/
文件夹中执行它时,我得到:
python -c "import xgboost; print(xgboost.__version__)"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/dmitry/dev/mlenv/lib/python3.6/site-packages/xgboost-0.6-py3.6.egg/xgboost/__init__.py", line 21, in <module>
with open(VERSION_FILE) as f:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/dmitry/dev/mlenv/lib/python3.6/site-packages/xgboost-0.6-py3.6.egg/xgboost/VERSION'
How to resolve this issue? 如何解决这个问题?
As a workaround, I did: 作为解决方法,我做到了:
import sys
sys.path.append('<your-path-here>/xgboost/python-package')
您只需注释这些行,然后一切正常!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.