root@0c6c17725a7b :/# pip install xgboost
xgboost ๋ค์ด๋ก๋/ํ๊ธฐ
xgboost ์๊ตฌ ์ฌํญ์ ์ถฉ์กฑํ๋ ๋ฒ์ ์ ์ฐพ์ ์ ์์ต๋๋ค(๋ฒ์ : 0.4a12, 0.4a13).
์ฒญ์...
xgboost ๋ฒ์ ๊ณผ ์ผ์นํ๋ ๋ฐฐํฌํ ์์
/root/.pip/pip.log์ ์คํจ์ ๋ํ ๋๋ฒ๊ทธ ๋ก๊ทธ ์ ์ฅ
๋ค์์ ์ฌ์ฉํ์ฌ ๋์ปค์์ ๋ฐ๋ณตํ ์ ์์ต๋๋ค.
๋์ปค ์คํ -it --rm ์ฐ๋ถํฌ:์ ๋ขฐ
apt-get update
apt-get install python-pip
pip install xgboost
์ด๊ฒ๋ ์ฐธ์กฐ:
http://stackoverflow.com/questions/32258463/install-xgboost-under-python-failing
๋๋ฅผ ์ํด ์๋ํ์ง ์๋ ๊ฒ ๊ฐ์ต๋๋ค
ubuntu@ip-172-31-11-169 :~$ sudo apt-get ์
๋ฐ์ดํธ
...์ผ๋ค์ผ๋ค
ubuntu@ip-172-31-11-169 :~$ sudo apt-get install python-pip
ํจํค์ง ๋ชฉ๋ก์ ์ฝ๋ ์ค... ์๋ฃ
์์กด์ฑ ํธ๋ฆฌ ๊ตฌ์ถ
์ํ ์ ๋ณด๋ฅผ ์ฝ๋ ์ค... ์๋ฃ
python-pip๋ ์ด๋ฏธ ์ต์ ๋ฒ์ ์
๋๋ค.
0๊ฐ ์
๊ทธ๋ ์ด๋, 0๊ฐ ์๋ก ์ค์น, 0๊ฐ ์ ๊ฑฐ ๋ฐ 74๊ฐ ์
๊ทธ๋ ์ด๋๋์ง ์์.
ubuntu@ip-172-31-11-169 :~$ sudo pip install xgboost
xgboost ๋ค์ด๋ก๋/ํ๊ธฐ
xgboost ์๊ตฌ ์ฌํญ์ ์ถฉ์กฑํ๋ ๋ฒ์ ์ ์ฐพ์ ์ ์์ต๋๋ค(๋ฒ์ : 0.4a12, 0.4a13).
์ฒญ์...
xgboost ๋ฒ์ ๊ณผ ์ผ์นํ๋ ๋ฐฐํฌํ ์์
/home/ubuntu/.pip/pip.log์ ์คํจ์ ๋ํ ๋๋ฒ๊ทธ ๋ก๊ทธ ์ ์ฅ
ubuntu@ip-172-31-11-169 :~$
--pre์ stackoverflow ์ ์์ ๋ค์์ ์์ฑํ์ต๋๋ค.
ubuntu@ip-172-31-11-169 :~$ sudo pip install --pre xgboost
xgboost ๋ค์ด๋ก๋/ํ๊ธฐ
xgboost-0.4a13.tar.gz ๋ค์ด๋ก๋(690kB): 690kB ๋ค์ด๋ก๋
xgboost ํจํค์ง์ ๋ํ setup.py(๊ฒฝ๋ก:/tmp/pip_build_root/xgboost/setup.py) egg_info ์คํ
xgboost/build-python.sh: 13: xgboost/build-python.sh: pushd: ์ฐพ์ ์ ์์
make: * ๋์ python'. Stop.
-----------------------------
Building multi-thread xgboost failed
Start to build single-thread xgboost
make: *** No rule to make target
๋ฅผ ๊นจ๋ํ๊ฒ ๋ง๋๋ ๊ท์น์ด ์์ต๋๋ค'.
์ค์ง.๋จ์ผ ์ค๋ ๋ xgboost ๋น๋ ์ฑ๊ณต๋ฉํฐ ์ฐ๋ ๋ ๋ฒ์ ์ ์ํ์ ๋ค๋ฉดdoc/build.md์ ์ถ๊ฐ ์ง์นจ์ ์ฐธ์กฐํ์ธ์.xgboost/build-python.sh: 26: xgboost/build-python.sh: popd: ์ฐพ์ ์ ์์(์์, ์์)์ญ์ถ์ (๊ฐ์ฅ ์ต๊ทผ ํธ์ถ ๋ง์ง๋ง):ํ์ผ "
self._handle = _dlopen(self._name, ๋ชจ๋)
OSError: /tmp/pip_build_root/xgboost/xgboost/./wrapper/libxgboostwrapper.so: ์ ํจํ์ง ์์ ELF ํค๋
python setup.py egg_info ๋ช
๋ น์ ์ ์ฒด ์ถ๋ ฅ:
xgboost/build-python.sh: 13: xgboost/build-python.sh: pushd: ์ฐพ์ ์ ์์
make: *** ๋์์ 'ํ์ด์ฌ'์ผ๋ก ๋ง๋๋ ๊ท์น์ด ์์ต๋๋ค. ์ค์ง.
๋ค์ค ์ค๋ ๋ xgboost ๋น๋ ์คํจ
๋จ์ผ ์ค๋ ๋ xgboost ๋น๋ ์์
make: *** ๋์์ '๊นจ๋'ํ๊ฒ ๋ง๋๋ ๊ท์น์ด ์์ต๋๋ค. ์ค์ง.
make: *** ๋์์ 'ํ์ด์ฌ'์ผ๋ก ๋ง๋๋ ๊ท์น์ด ์์ต๋๋ค. ์ค์ง.
๋จ์ผ ์ค๋ ๋ xgboost ๋น๋ ์ฑ๊ณต
๋ฉํฐ ์ฐ๋ ๋ ๋ฒ์ ์ ์ํ์ ๋ค๋ฉด
doc/build.md์ ์ถ๊ฐ ์ง์นจ์ ์ฐธ์กฐํ์ธ์.
xgboost/build-python.sh: 26: xgboost/build-python.sh: popd: ์ฐพ์ ์ ์์
(์์, ์์)
์ญ์ถ์ (๊ฐ์ฅ ์ต๊ทผ ํธ์ถ ๋ง์ง๋ง):
ํ์ผ "
ํ์ผ "/tmp/pip_build_root/xgboost/setup.py", 20ํ,
import xgboost
ํ์ผ "./xgboost/ init .py", 8ํ,
from .core import DMatrix, Booster
ํ์ผ "./xgboost/core.py", 78ํ,
_LIB = _load_lib()
ํ์ผ "./xgboost/core.py", 72ํ, _load_lib
lib = ctypes.cdll.LoadLibrary(lib_path[0])
LoadLibrary์ ํ์ผ "/usr/lib/python2.7/ctypes/ init .py", 443ํ
return self._dlltype(name)
ํ์ผ "/usr/lib/python2.7/ctypes/ init .py", 365ํ, init
self._handle = _dlopen(self._name, mode)
OSError: /tmp/pip_build_root/xgboost/xgboost/./wrapper/libxgboostwrapper.so: ์ ํจํ์ง ์์ ELF ํค๋
์ฒญ์...
/tmp/pip_build_root/xgboost์ ์ค๋ฅ ์ฝ๋ 1๊ณผ ํจ๊ป python setup.py egg_info ๋ช
๋ น์ด ์คํจํ์ต๋๋ค.
/home/ubuntu/.pip/pip.log์ ์คํจ์ ๋ํ ๋๋ฒ๊ทธ ๋ก๊ทธ ์ ์ฅ
ubuntu@ip-172-31-11-169 :~$
@cliveseldon @grfiv pip ์ค์น์ ๋ฒ์ ๊ด๋ฆฌ๋ ๊ณต์ ๋ฒ์ 0.4๊ฐ ์ค๋ซ๋์ ๊ฑฐ๊ธฐ์ ์์๊ณ pip ์ค์น์๋ ์์ค ์ฝ๋์ ์ต์ ์ ๋ฐ์ดํธ๊ฐ ํฌํจ๋์ด ์๊ธฐ ๋๋ฌธ์ ์ฝ๊ฐ์ ํผ๋์ด ์์ต๋๋ค. ๊ทธ๋์ ๋ฒ์ ์ด๋ฆ์ 0.4a12 0.4a13์ผ๋ก ์ง์ ํ์ต๋๋ค ๋ฌด์. ์ฐจํ ์ ์ ๋ฆด๋ฆฌ์ฆ๋ถํฐ ์์ ๋ ์์ ์ ๋๋ค.
pip ์ค์น๋ฅผ ์
๋ฐ์ดํธํ๊ธฐ ์ํ ์ข์ ์๋ฃจ์
์ ์ฌ์ดํธ ํจํค์ง ๋๋ ํ ๋ฆฌ์์ xgboost ๋๋ ํ ๋ฆฌ์ xgboost-0.4a13.dist-info ๋๋ ํ ๋ฆฌ๋ฅผ ๋ชจ๋ ์ญ์ ํ๋ ๊ฒ์
๋๋ค(์: /User/phunterlau/python2.7/site-packages/
(์ค์น ์์น๋ print xgboost.__file__
์์ ์ฐพ์ ์ ์์)
์๋
ํ์ธ์,
๋ด ์ฐ๋ถํฌ ์์์ ๋์ผํ ๋ฌธ์ ๊ฐ ์์ต๋๋ค.
์คํํ๋ ค๋ฉด:
sudo -H pip install --pre xgboost
python -c "import xgboost"
๋ค์๊ณผ ๊ฐ์ด ์คํจํฉ๋๋ค.
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/xgboost/__init__.py", line 11, in <module>
from .core import DMatrix, Booster
File "/usr/local/lib/python2.7/dist-packages/xgboost/core.py", line 92, in <module>
_LIB = _load_lib()
File "/usr/local/lib/python2.7/dist-packages/xgboost/core.py", line 86, in _load_lib
lib = ctypes.cdll.LoadLibrary(lib_path[0])
File "/usr/lib/python2.7/ctypes/__init__.py", line 443, in LoadLibrary
return self._dlltype(name)
File "/usr/lib/python2.7/ctypes/__init__.py", line 365, in __init__
self._handle = _dlopen(self._name, mode)
OSError: /usr/local/lib/python2.7/dist-packages/xgboost/./wrapper/libxgboostwrapper.so: invalid ELF header
๋๋ ๋ํ --pre ์์ด ์๋ํ์ง๋ง ๋์ผํ๊ฒ ์คํจํฉ๋๋ค.
์ด๋ค ๋จ์?
๊ฐ์ฌ ํด์,
์ํ.
Mac OSX์ xgboost-0.4a14๋ฅผ ์ค์นํ๊ธฐ ์ํด pip install xgboost๋ฅผ ์ฌ์ฉํ์ต๋๋ค. ๋ก๋ํ๋ ค๊ณ ํ๋ฉด ์ด ์ค๋ฅ๊ฐ ๋ฐ์ํ์ต๋๋ค.
OSError Traceback(๊ฐ์ฅ ์ต๊ทผ ํธ์ถ ๋ง์ง๋ง)
----> 1 xgboost๋ฅผ xgb๋ก ๊ฐ์ ธ์ค๊ธฐ
/Users/azaitzeff/anaconda/lib/python2.7/site-packages/xgboost/ init .py in
9 ์์
OS
10
---> .core์์ 11 ๊ฐ์ ธ์ค๊ธฐ DMatrix, Booster
.training ์์
์ด์ฐจ์์ 12, ์ด๋ ฅ์
.sklearn์์ 13 ๊ฐ์ ธ์ค๊ธฐ XGBModel, XGBClassifier, XGBRegressor
/Users/azaitzeff/anaconda/lib/python2.7/site-packages/xgboost/core.py
90
91 # XGBoost ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ ์ญ์ ์ผ๋ก ๋ก๋
---> 92 _LIB = _load_lib()
93
94 def _check_call(ret):
/Users/azaitzeff/anaconda/lib/python2.7/site-packages/xgboost/core.py _load_lib()
84 if len(lib_path) == 0:
85 ๋ฐํ ์์
---> 86 ๋ผ์ด๋ธ๋ฌ๋ฆฌ = ctypes.cdll.LoadLibrary(lib_path[0])
87 lib.XGBGetLastError.restype = ctypes.c_char_p
88 ๋ฆฌํด ๋ผ์ด๋ธ๋ฌ๋ฆฌ
/Users/azaitzeff/anaconda/lib/python2.7/ctypes/ LoadLibrary(์์ฒด, ์ด๋ฆ)์ init .pyc
441
442 def LoadLibrary(์์ , ์ด๋ฆ):
--> 443 ๋ฐํ self._dlltype(์ด๋ฆ)
444
445 ๅฏๅ = ็ฒๅ
/Users/azaitzeff/anaconda/lib/python2.7/ctypes/ init .pyc in init (์์ฒด, ์ด๋ฆ, ๋ชจ๋, ํธ๋ค, use_errno, use_last_error)
363
364 ํธ๋ค์ด ์์์ธ ๊ฒฝ์ฐ:
--> 365 self._handle = _dlopen(self._name, ๋ชจ๋)
366 ๊ธฐํ:
367*
OS ์ค๋ฅ: dlopen(/Users/azaitzeff/anaconda/lib/python2.7/site-packages/xgboost/./wrapper/libxgboostwrapper.so, 6): ๋ผ์ด๋ธ๋ฌ๋ฆฌ๊ฐ ๋ก๋๋์ง ์์: /usr/local/lib/gcc/4.9/libgomp .1.dylib
์ฐธ์กฐ: /Users/azaitzeff/anaconda/lib/python2.7/site-packages/xgboost/./wrapper/libxgboostwrapper.so
์ด์ : ์ด๋ฏธ์ง๋ฅผ ์ฐพ์ ์ ์์
๋์์ด ํ์ํฉ๋๋ค. ๊ฐ์ฌ ํด์
AZ
@AZaitzeff @Fkawala ๊ฐ์ฌํฉ๋๋ค. ์ฐ๋ถํฌ ๋๋ Mac์ gcc๊ฐ ์ค์น๋์ด ์๋์ง ํ์ธํ ์ ์์ต๋๊น? ๊ทํ์ ์ ๋ณด๋ฅผ ๋ณด๋ฉด ๋ฏธ๋ฆฌ ์ปดํ์ผ๋ lib์ ๋ฌธ์ ๊ฐ ์์ต๋๋ค. ์์คํ ์ gcc๊ฐ ์ค์น๋์ด ์์ง ์์ผ๋ฉด pip์ ๋น๋ ์คํฌ๋ฆฝํธ๊ฐ ์คํจํฉ๋๋ค. ๊ทธ๋ฌ๋ pip ์ค์น ํจํค์ง์๋ Mac์์ brew์ gcc 4.9๋ฅผ ์ฌ์ฉํ์ฌ ๋ฏธ๋ฆฌ ์ปดํ์ผ๋ lib libxgboostwrapper.so๊ฐ ํฌํจ๋์ด ์์ผ๋ฏ๋ก ๋น๋ ์คํฌ๋ฆฝํธ๊ฐ ์คํจํ๋ฉด xgboost๊ฐ ์ด ๋ฏธ๋ฆฌ ์ปดํ์ผ๋ lib๋ฅผ ๊ฒ์ํฉ๋๋ค. Linux๋ ์ด Mac ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ธ์ํ์ง ๋ชปํ๋ฏ๋ก ELF ์ฝ๋ ์ค๋ฅ๊ฐ ์์ต๋๋ค. OpenMP๊ฐ ์๋ Mac์ ๊ฒฝ์ฐ ๋งํฌ ์ค๋ฅ๊ฐ ๋ฐ์ํฉ๋๋ค. ์ด์ ๋๋ ๊ทธ๊ฒ์ด ์ฝ๊ฐ์ ํผ๋์ ์ผ์ผํค๊ณ ์ข์ ์๊ฐ์ด ์๋ ์๋ ์์์ ์์์ต๋๋ค. pip ์ค์น๋ฅผ ์ ๋ฐ์ดํธํ๊ณ gcc๊ฐ ์์ผ๋ฉด ๋ฉ์์ง๋ฅผ ํ์ํฉ๋๋ค. ์ถ์ : ๋ค์ ๊ณต์ ๋ฆด๋ฆฌ์ค์์๋ ์ฌ์ ์ปดํ์ผ๋๊ณ ์ ์ ๋งํฌ๋ lib๊ฐ ์์ ์์ ์ ๋๋ค. ์ด๋ ์ฌ์ ์ปดํ์ผ๋ ์ฝ๋๋ฅผ ์ ๊ณตํ๋ ๋ ๋์ ์๋ฃจ์ ์ ๋๋ค.
@phunterlau ๊ฐ์ฌํฉ๋๋ค. ๋ด Mac์ OpenMP๊ฐ ์์ต๋๋ค. ๊ทธ๋์ ๊ทธ๊ฒ์ด ์ค๋ฅ๋ฅผ ์ผ์ผํจ ๊ฒ์ ๋๋ค.
@phunterlau ok, ์ ์ ํ ์ปดํ์ผ ํ๊ฒฝ์ ์ค์ ํ๊ณ pip ์ค์น๋ฅผ ๋ค์ ํ ์คํธํ๊ฒ ์ต๋๋ค.
๋น ๋ฅธ ๋ต๋ณ ๊ฐ์ฌํฉ๋๋ค.
๊ทธ๋์ brew install clang-omp ๋ฅผ ์คํํ๊ณ ์ค์นํ์ต๋๋ค. xgboost ๋๋ ํ ๋ฆฌ์ xgboost-0.4a13.dist-info๋ฅผ ์ญ์ ํ๊ณ pip install xgboost๋ฅผ ๋ค์ ์คํํ์ต๋๋ค. ํฐ๋ฏธ๋ ์ฐฝ์ ๋ซ์๋ค๊ฐ ๋ค์ ์ด์์ต๋๋ค. ํ์ง๋ง xgboost๋ฅผ ๊ฐ์ ธ์ค๋ ค๊ณ ํ ๋ ์ฌ์ ํ ๋์ผํ ์ค๋ฅ๊ฐ ๋ฐ์ํฉ๋๋ค. ์ด๊ฒฌ์๋ ์ฌ๋?
@AZaitzeff ์ค์ ๋ก clang-omp๋ ๊ถ์ฅํ์ง ์์ต๋๋ค. Xcode์ clang-omp๊ฐ ์ง์ํ์ง ์์ผ๋ฏ๋ก clang-omp๊ฐ ์ด์ํ ๊ฒฐ๊ณผ๋ฅผ ์ค ์ ์๊ธฐ ๋๋ฌธ์
๋๋ค. mac pip ์ค์น ํจํค์ง๋ OpenMP๋ฅผ ์ฌ์ฉํ์ฌ brew์ gcc 4.9์์ ์์ฑ ๋ฐ ํ
์คํธ๋์์ต๋๋ค. brew install gcc49
๋ก ์๋ํ์๊ฒ ์ต๋๊น? ์ด์ brew์ gcc 5๋ ์์ง๋ง ์์ ํ ํ
์คํธํ ๊ธฐํ๊ฐ ์์์ต๋๋ค. ๋ค์ pip ์
๋ก๋์์ ํ๋๋ก ํ๊ฒ ์ต๋๋ค.
๋๋ถ์ ํจ๊ณผ๊ฐ ์ข์์ต๋๋ค.
@phunterlau ๋น๋( ./xgboost/build-python.sh
์ฌ์ฉ)๋ ๋งค๋ ฅ์ฒ๋ผ ์๋ํฉ๋๋ค. ๊ทธ๋ฌ๋ pip ์ค์น๋ ๋ฏธ๋ฆฌ ์ปดํ์ผ๋ lib๋ฅผ ์์ฑํฉ๋๋ค. ์ปดํ์ผ์ด ์๋๋์ง ์๋ ์ด์ ๋ฅผ ๋ณด์ฌ์ฃผ๊ธฐ ์ํด setup.py
๋ฅผ ์์ ํ์ต๋๋ค. PIP 7.1.2(python 2.7)๋ฅผ ์ฌ์ฉํ์ฌ ๋ค์์ ์คํํฉ๋๋ค.
pip install --user -e ./tweaked-xgboost-0.4a13/
์ ๊ณต:
'pip' in __file__: False
not os.name == 'nt': True
http://stackoverflow.com/questions/9959279/detect-pip-in-setup-py [1] ์ ๋ฐ๋ฅด๋ฉด 'pip' in __file__
ํ
์คํธ๋ Py 2.7 2014-10-27 ๋๋ ์ฌ์ฉ์ ์ง์ ์ค์น( ๋ด ์ด์ ์๊ฒฌ์์ ์ฌ์ฉํ ๊ฒ์ฒ๋ผ). [1] 'pip' in os.environ.get('_')
์์ ์ ์๋ ๊ฒ์ฒ๋ผ pip ๊ฐ setup.py
๋ฅผ ์คํํ๋์ง ํ
์คํธํ๋ ๋ณด๋ค ํ์ค์ ์ธ ๋ฐฉ๋ฒ์
๋๋ค.
@Fkawala ๊ฐ์ฌํฉ๋๋ค. 'pip' in __file__
์(๋) ์ค๋์ ์ ์ฌ์ฉํ๋ ์ค๋๋ ํธ๋ฆญ์ด์์ต๋๋ค. ์๋ก์ด ๊ฒ์ ์๊ฒ ๋์ด ๋ฐ๊ฐ์ต๋๋ค. ๋๋ pip ์ค์น๋ฅผ ์
๋ฐ์ดํธํ๊ณ ๋์ค์ PR(์ผ๋ถ ๋ค๋ฅธ ํจ์น์ ํจ๊ป)์ ๋ณด๋ผ ๊ฒ์
๋๋ค.
@phunterlau ๋น์ทํ ๋ฌธ์ ๊ฐ ์๋๋ฐ ์ด ELF ์ค๋ฅ๋ฅผ ์์ ํ๋ ๋ฐฉ๋ฒ์ ์ดํดํ์ง ๋ชปํ์ต๋๋ค. ์ฐ๋ถํฌ์์ ์์ ์ค์ด๋ฉฐ pip๋ก ์ค์นํ ํ xgboost ํจํค์ง๋ฅผ ๊ฐ์ ธ์ฌ ์ ์์ต๋๋ค. ๋น์ ์ gcc์ ๋ํด ์ผ๊ณ , ๋๋ gcc-4.9๋ฅผ ์ค์นํ์ง๋ง ์ฌ์ ํ ์๋ํ์ง ์์ต๋๋ค. ๋ด๊ฐ ๋ฌด์์ ๋์น๊ณ ์์ต๋๊น?
๋ด ์ค๋ฅ๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
OSError Traceback(๊ฐ์ฅ ์ต๊ทผ ํธ์ถ ๋ง์ง๋ง)
----> 1 xgboost ๊ฐ์ ธ์ค๊ธฐ
/home/antklen/anaconda/lib/python2.7/site-packages/xgboost/ init .py in
9 ์์
OS
10
---> .core์์ 11 ๊ฐ์ ธ์ค๊ธฐ DMatrix, Booster
.training ์์
์ด์ฐจ์์ 12, ์ด๋ ฅ์
.sklearn์์ 13 ๊ฐ์ ธ์ค๊ธฐ XGBModel, XGBClassifier, XGBRegressor
/home/antklen/anaconda/lib/python2.7/site-packages/xgboost/core.py์์
90
91 # XGBoost ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ ์ญ์ ์ผ๋ก ๋ก๋
---> 92 _LIB = _load_lib()
93
94 def _check_call(ret):
/home/antklen/anaconda/lib/python2.7/site-packages/xgboost/core.py _load_lib()
84 if len(lib_path) == 0:
85 ๋ฐํ ์์
---> 86 ๋ผ์ด๋ธ๋ฌ๋ฆฌ = ctypes.cdll.LoadLibrary(lib_path[0])
87 lib.XGBGetLastError.restype = ctypes.c_char_p
88 ๋ฆฌํด ๋ผ์ด๋ธ๋ฌ๋ฆฌ
/home/antklen/anaconda/lib/python2.7/ctypes/__init__.pyc in LoadLibrary(์์ฒด, ์ด๋ฆ)
441
442 def LoadLibrary(์์ , ์ด๋ฆ):
--> 443 ๋ฐํ self._dlltype(์ด๋ฆ)
444
445 ๅฏๅ = ็ฒๅ
/home/antklen/anaconda/lib/python2.7/ctypes/__init__.pyc init (์์ฒด, ์ด๋ฆ, ๋ชจ๋, ํธ๋ค, use_errno, use_last_error)
363
364 ํธ๋ค์ด ์์์ธ ๊ฒฝ์ฐ:
--> 365 self._handle = _dlopen(self._name, ๋ชจ๋)
366 ๊ธฐํ:
367*
OSError: /home/antklen/anaconda/lib/python2.7/site-packages/xgboost/./wrapper/libxgboostwrapper.so: ์ ํจํ์ง ์์ ELF ํค๋
Windows์์ @antklen ์ ์ฌ์ฉํ๋ ค๋ฉด ๋จผ์ setuptools๋ฅผ ์ค์นํด์ผ ํฉ๋๋ค. ๊ทธ๊ฒ์ด ์ฐ๋ถํฌ์ ๊ฒฝ์ฐ์ธ์ง ํ์คํ์ง ์์ง๋ง ์๋ํด ๋ณผ ๊ฐ์น๊ฐ ์์ต๋๊น?
@antklen ํ์ฌ pip ์ค์น๊ฐ ์ฆ์ ์ปดํ์ผ๋ฌ ์คํฌ๋ฆฝํธ์ด๊ณ ์ผ๋ถ Mac ์ฌ์ฉ์๊ฐ ์ปดํ์ผ์ ์ํด g++๋ฅผ ์ค์นํ์ง ์์ ๊ฒฝ์ฐ๋ฅผ ๋๋นํ์ฌ Mac ๋ฒ์ ์ .so ํ์ผ๊ณผ ํจ๊ป ์ ๊ณต๋๊ธฐ ๋๋ฌธ์ ๋๋ค. ๊ทธ๊ฒ์ ์ข์ ์๊ฐ์ด ์๋ ๊ฒ์ผ๋ก ๋ฐํ์ก๊ณ Linux ์ฌ์ฉ์์๊ฒ ์ฝ๊ฐ์ ํผ๋์ ์ผ๊ธฐํ์ต๋๋ค.
ํด๊ฒฐ์ฑ
์ gcc ๋ฐ g++ apt-get install g++
๋ฅผ ์ค์นํ์ฌ ์ปดํ์ผ ์คํฌ๋ฆฝํธ๋ฅผ ๊ฐ์ ธ์ค๋ ๊ฒ์
๋๋ค.
๊ทธ๋ฆฌ๊ณ pip๊ฐ 0.7.1.2๋ณด๋ค ์ต์ ๋ฒ์ ์ด๋ฉด pip๊ฐ ์คํ ์ค์ธ์ง ํ์ธํ๋ ๋ ๋ค๋ฅธ ๋ฌธ์ ๊ฐ ์์ ์ ์์ต๋๋ค. ๋ค์ ๋ฆด๋ฆฌ์ค์์ ์์ ํ์ฌ ๋ฐฐ์กํ๊ฒ ์ต๋๋ค. g++์ด ์์ง๋ง ์ฌ์ ํ ๋์ผํ ์ค๋ฅ๊ฐ ๋ฐ์ํ๋ฉด ์ค์น ๋ฌธ์์ ๋ฐ๋ผ setup.py์์ ์๋์ผ๋ก ์ค์นํ์ญ์์ค.
@smargsongithub @phunterlau ๋ต๋ณ ๊ฐ์ฌํฉ๋๋ค!
apt-get install g++๋ ์๋ํ์ง ์์์ง๋ง ์ฌ๊ธฐ์ ์ค๋ช
๋ ๋๋ก ์๋ ์ค์น์ ์ฑ๊ณตํ์ต๋๋ค. https://www.kaggle.com/c/springleaf-marketing-response/forums/t/16320/cloud-vs- ๋ก์ปฌ ๋จธ์ ์ฐฌ๋ฐ ์๋ก
Anaconda๋ฅผ ์ฌ์ฉํ๊ธฐ ๋๋ฌธ์ ๋ช ๊ฐ์ง ๋ฌธ์ ๊ฐ ๋ฐ์ํ์ฌ ์ต์ข
๋ ์ํผ๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
sudo apt-get install make
sudo apt-get ์
๋ฐ์ดํธ
sudo apt-get ์ค์น gcc
sudo apt-get install g++
sudo apt-get install git
sudo ์์ ๋ณต์ https://github.com/dmlc/xgboost
CD xgboost
sudo ./build.sh
cd ํ์ด์ฌ ํจํค์ง
sudo /home/username/anaconda/bin/python setup.py ์ค์น
@antklen ์ค, g++๋ฅผ ์ค์นํ ๋ sudo๊ฐ ํ์ํฉ๋๋ค :-)
@Fkawala ์
๋ฐ์ดํธ๋ pip์ ๋ํด 'pip' in os.environ.get('_')
๋ฅผ ์๋ํ๊ณ ์์ง๋ง os.environ.get('_')
๋ ํญ์ None
๋ฅผ ๋ฐํํ๊ณ ์ด if ๋ฌธ์ ์ค๋ฅ๋ฅผ ์ ๊ณตํฉ๋๋ค. ๋ช
๋ น์ค์์ pip์ธ์ง ๊ฐ์งํ๋ ๋ค๋ฅธ ๋ฐฉ๋ฒ์ด ์์ต๋๊น? ๊ทธ๋ ์ง ์์ผ๋ฉด pip์ ๋ํด์๋ง ๋ณ๋์ setup.py
๋ฅผ ๋ง๋ค๊ณ ๊ฑฐ๊ธฐ์์ ์ปดํ์ผ๋ฌ๋ฅผ ํธ๋ฆฌ๊ฑฐํฉ๋๋ค. ๊ฐ์ฌ ํด์.
@phunterlau pip install xgboost์์ ๋ค์ ์ญ์ถ์ ์ ์ป๊ณ ์์ต๋๋ค. ์ด๋ค ์๊ฐ์ด ์์ต๋๊น? (๋งฅ์ ์คํ ์ค)
์ญ์ถ์ (๊ฐ์ฅ ์ต๊ทผ ํธ์ถ ๋ง์ง๋ง):
ํ์ผ "
ํ์ผ "/private/var/folders/7g/thc6mmqd2nb55r21htwx2slr0000gp/T/pip-build-0BlCW9/xgboost/setup.py", 38ํ,
LIB_PATH = ๋ผ์ด๋ธ๋ฌ๋ฆฌ ๊ฒฝ๋ก 'find_lib_path'
ํ์ผ "/private/var/folders/7g/thc6mmqd2nb55r21htwx2slr0000gp/T/pip-build-0BlCW9/xgboost/xgboost/libpath.py", 47ํ, find_lib_path
'c ํ๋ณด ๋ชฉ๋ก :n ' + ('n'.join(dll_path)))
builtin .XGBoostLibraryNotFound: ํ๋ณด ๊ฒฝ๋ก์์ XGBoost Libarary๋ฅผ ์ฐพ์ ์ ์์ต๋๋ค. ๋ฃจํธ ๊ฒฝ๋ก์์ build.sh๋ฅผ ์คํํ์ต๋๊น?
ํ๋ณด์ ๋ชฉ๋ก:
/private/var/folders/7g/thc6mmqd2nb55r21htwx2slr0000gp/T/pip-build-0BlCW9/xgboost/xgboost/libxgboostwrapper.so
/private/var/folders/7g/thc6mmqd2nb55r21htwx2slr0000gp/T/pip-build-0BlCW9/xgboost/xgboost/../../wrapper/libxgboostwrapper.so
/private/var/folders/7g/thc6mmqd2nb55r21htwx2slr0000gp/T/pip-build-0BlCW9/xgboost/xgboost/./wrapper/libxgboostwrapper.so
/private/var/folders/7g/thc6mmqd2nb55r21htwx2slr0000gp/T/pip-build-0BlCW9/xgboost/xgboost/../../../xgboost/wrapper/libxgboostwrapper.so
/private/var/folders/7g/thc6mmqd2nb55r21htwx2slr0000gp/T/pip-build-0BlCW9/xgboost์์ "python setup.py egg_info" ๋ช ๋ น์ด ์ค๋ฅ ์ฝ๋ 1๊ณผ ํจ๊ป ์คํจํ์ต๋๋ค.
@pcohen89 ์ด python ํจํค์ง๋ C++ ์ฝ๋์ ํจ๊ป ์ ๊ณต๋๊ณ ์ฆ์์์ ์ปดํ์ผ๋๋ฏ๋ก ์ปดํ์ผ๋ฌ๊ฐ ํ์ํ ์ ์์ต๋๋ค. Xcode์ gcc-5 ๋๋ clang LLVM๊ณผ ๊ฐ์ ์ปดํ์ผ๋ฌ๊ฐ ์ค์น๋์ด ์์ต๋๊น? Mac์ ๊ธฐ๋ณธ์ ์ผ๋ก xcode ๋ช
๋ น์ค ๋๊ตฌ๋ฅผ ์ค์นํ์ง ์์ผ๋ฉฐ ์ด ์ง์นจ์ ๋ฐ๋ฅผ ์ ์์ต๋๋ค. http://railsapps.github.io/xcode-command-line-tools.html ๋๋ ๋ค๋ฅธ ๋ ๋์ ์ ํ์ homebrew
http ๋ฅผ ์ค์นํ๋ ๊ฒ์
๋๋ค. brew install g++-5
. ๋์ค ์ต์
(g++-5)์ ๋ค์ค ์ค๋ ๋ OpenMP ์ง์์ ์ ๊ณตํฉ๋๋ค.
์ปดํ์ผ๋ฌ๋ฅผ ์ค์นํ ํ ์ด์ xgboost ์ค์น๋ฅผ ์ ๊ฑฐํ๊ณ pip install xgboost
๋ฅผ ๋ค์ ์คํํ์ญ์์ค.
@antklen @phunterlau @antklen ์ด ์ธ๊ธํ ๋จ๊ณ์ ๋ฐ๋ผ ์๋ํ์ต๋๋ค. ์ด์ ํฐ๋ฏธ๋์์ import xgboost๋ฅผ ์คํํ ์ ์์ต๋๋ค. ๊ทธ๋ฌ๋ acondas ipython ๋ ธํธ๋ถ์์๋ ์๋ ์ค๋ฅ๊ฐ ๋ฐ์ํฉ๋๋ค. ์ด๋ค ๋์์ ์ฃผ์๊ธฐ ๋ฐ๋๋๋ค. ๋๋ ์ฐ๋ถํฌ๋ฅผ ์ฌ์ฉํ๊ณ ์์ต๋๋ค.
XGBoostLibraryNotFound: Cannot find XGBoost Libarary in the candicate path, did you run build.sh in root path?
List of candidates:
/home/simpl/anaconda/lib/python2.7/site-packages/xgboost-0.4-py2.7.egg/xgboost/libxgboostwrapper.so
/home/simpl/anaconda/lib/python2.7/site-packages/xgboost-0.4-py2.7.egg/xgboost/../../wrapper/libxgboostwrapper.so
/home/simpl/anaconda/lib/python2.7/site-packages/xgboost-0.4-py2.7.egg/xgboost/./wrapper/libxgboostwrapper.so
@Jeechu ๋ xgboost๊ฐ ์ปดํ์ผ๋์ง ์์์์ ์๋ฏธํฉ๋๋ค.
pip install xgboost -v
์ค๋ฅ ๋ฉ์์ง์ ๋ํด ์์ธํ ์ ์ ์์ต๋๋ค.
@phunterlau ์ ์ @Jeechu ์ฐ๋ฆฌ๋ ์ด์ xgboost ์ค์น๋ฅผ ์ ๊ฑฐํ๊ณ gcc,g++๋ฅผ ์ค์นํ์ต๋๋ค. XGBoost๋ ํฐ๋ฏธ๋์ ํตํด ์ ์คํ๋์ง๋ง anaconda ipython ๋ ธํธ๋ถ์ ์ฌ์ฉํ๋ฉด ํด๋น ์ค๋ฅ๊ฐ ๋ฐ์ํฉ๋๋ค.
์ค์น ๊ฒฝ๋ก์ ๋ฌธ์ ๊ฐ ์์ต๋๊น?
@rajdeltarobo @Jeechu ipython ๋
ธํธ๋ถ์ ํ์ด์ฌ ๋ฒ์ ์ ๋ฌด์์
๋๊น? .bashrc(๋๋ ์์ ๋ค๋ฅธ env ํ์ผ)์ ์๋ $PYTHONPATH
๋ณ์๋ ๋ฌด์์
๋๊น?
xgboost๊ฐ pip ์ค์น ๊ฒฝ๋ก๊ฐ ์๋ /home/simpl/anaconda/lib/python2.7/site-packages/xgboost-0.4-py2.7.egg/
๋ฅผ ๊ฒ์ํ๋ ๊ฒ ๊ฐ์ผ๋ฏ๋ก(pip ์ค์น์๋ xgboost-0.4a24์ ๊ฐ์ ์ถ๊ฐ ๋ฒ์ ๋ฒํธ๊ฐ ์์), ipython ๋
ธํธ๋ถ์ python setup.py install
์์ xgboost๋ฅผ ๊ฒ์ํ๋ ค๊ณ ์๋ํฉ๋๋ค. ๋ฐ๋ผ์ ๋ฌธ์ ๋ $PYTHONPATH
์์ ์ฌ ์ ์์ต๋๋ค.
@phunterlau $PYTHONPATH
๊ฐ ์ ์๋์ง ์์ ๊ณต๋ฐฑ์ ๋ฐํํฉ๋๋ค. ๊ทธ๋ฌ๋ ์๋๋ path์ ๊ฐ์
๋๋ค.
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/home/simpl/anaconda/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ํ์ด์ฌ ๊ฒฝ๋ก๋
โ ~ which python
/usr/bin/python
ipython ๋ ธํธ๋ถ์ ํ์ด์ฌ ๋ฒ์ ์ 2.7์ ๋๋ค.
๋ค์๊ณผ ๊ฐ์ ๊ฒ์ PYTHONPATH์ ์ถ๊ฐํ๋ ๊ฒ์ ์ด๋ป์ต๋๊น?
/Users/simpl/anaconda/lib/python2.7/site-packages/
anaconda์ python์ ์ฌ์ฉํ๋ ค๋ฉด ๋ชจ๋ ๊ฒ์ ๋ํด ๊ทธ๋๋ก ์ ์งํ๊ณ , ๊ทธ๋ ์ง ์์ผ๋ฉด ์ฌ๋ฌ python ์ค์น ๋์ virtualenv
๋ฅผ ์ฌ์ฉํ์ญ์์ค. ๋์ผํ ์์คํ
์ ์ฌ๋ฌ ๊ฐ์ python ์ค์น๊ฐ ์๋ ๊ฒฝ์ฐ ๋งค์ฐ ํผ๋์ค๋ฝ์ต๋๋ค.
@phunterlau ์๋ํ์ง ์์ต๋๋ค. ๋๋ ์ฐ๋ถํฌ๋ฅผ ์ฌ์ฉํ๊ณ ์์ผ๋ฏ๋ก ์ถ๊ฐ
/home/user/anaconda/lib/python2.7/site-packages/
Bashrc ํ์ผ์ ๋์์ ์ด๊ฒ์ ๋ณผ ์ ์์ง๋ง
# added by Anaconda 2.3.0 installer
export PATH="/home/user/anaconda/bin:$PATH"
@phunterlau ๋๋ gcc๋ฅผ ์ค์นํ๊ณ ๊ทธ๊ฒ์ผ๋ก ์ถฉ๋ถํ๋ค๊ณ ์๊ฐํ์ต๋๋ค. Xcode๊ฐ ์๊ณ ๋ชจ๋ ์๋ํ์ต๋๋ค. Xgboost์ ๋ํ ์ง์์ ๊ฐ์ฌ๋๋ฆฝ๋๋ค. ์ ๋ง ๋๋จํ๊ณ ๋์์ด ๋ง์ด ๋ฉ๋๋ค.
@pcohen89 xcode๊ฐ ๋์์ด ๋์๋ค๋ ๋ฐ๊ฐ์ต๋๋ค. xcode clang์ ๋จ์ผ ์ค๋ ๋ xgboost๋ง ์ง์ํ๋ฏ๋ก ๋ค์ค ์ค๋ ๋ ์ง์์ ์ํด brew install g++-5
๋ฅผ ์๋ํ ์ ์์ต๋๋ค. ์ด์จ๋ ์์
์ฌ๋ณธ์ ์ข์ ์ฌ๋ณธ์
๋๋ค.
@rajdeltarobo PATH๋ PYTHONPATH์ ๋ค๋ฆ ๋๋ค. ์ฌ๊ธฐ์ PYTHONPATH๋ฅผ ์ฌ์ฉํ๋ฉด Python์ด ์ฌ์ฉ์ ์ง์ ํจํค์ง ์ค์น๋ฅผ ์ฐพ์ ์ ์์ต๋๋ค. ๊ทธ๊ฒ์ ์ถ๊ฐํ๊ณ bashrc๋ฅผ ์์ฑํ์ญ์์ค.
/wrapper/libxgboostwrapper.so๋ฅผ /home/username/anaconda3/lib/python3.4/site-packages/xgboost-0.4-py3.4.egg/xgboost/์ ๋ณต์ฌํ์ฌ ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ์ต๋๋ค(Ubuntu 14.04 ์ฌ์ฉ ์ค).
๋ด ๋ฌธ์ ๋ :
XGBoostLibraryNotFound: ํ๋ณด ๊ฒฝ๋ก์์ XGBoost Libarary๋ฅผ ์ฐพ์ ์ ์์ต๋๋ค. ๋ฃจํธ ๊ฒฝ๋ก์์ build.sh๋ฅผ ์คํํ์
จ์ต๋๊น?
ํ๋ณด์ ๋ชฉ๋ก:
/home/simpl/anaconda/lib/python2.7/site-packages/xgboost-0.4-py2.7.egg/xgboost/libxgboostwrapper.so
/home/simpl/anaconda/lib/python2.7/site-packages/xgboost-0.4-py2.7.egg/xgboost/../../wrapper/libxgboostwrapper.so
/home/simpl/anaconda/lib/python2.7/site-packages/xgboost-0.4-py2.7.egg/xgboost/./wrapper/libxgboostwrapper.so
@davutpolat ๋ฉ์์ง์ ์ค๋ฅ๋ pip ์ค์น์ ๋ํ ์ถฉ๋ ํด๊ฒฐ์ ์ํ ์ต๊ทผ ๋ณ๊ฒฝ์์ ๋น๋กฏ๋์์ง๋ง ๋ณ๊ฒฝ์ด ์ข์ ์๊ฐ์ด ์๋ ๊ฒ์ผ๋ก ํ๋ช ๋์ด ๋กค๋ฐฑํ์ต๋๋ค(PR #572). ์์ผ๋ก๋ ์ด ๋ณต์ฌ๋ณธ์ด ํ์ํ์ง ์์ผ๋ฉฐ, ์ฆ์์์ ์ปดํ์ผํ๋ pip ์ค์น๋ง์ ์ํ ๋ ๋ค๋ฅธ ๋ณ๋์ ์ค์ ๊ตฌ์ฑ์ ๊ฐ๊ฒ ๋ ๊ฒ์ ๋๋ค. ์ ๋ฉฐ์น ๊ฐ ์ด์ฉ์ ๋ถํธ์ ๋๋ ค ์ฃ์กํฉ๋๋ค.
pip๋ฅผ ํตํด xgboost๋ฅผ ์ค์นํ๋ ค๊ณ ํ์ง๋ง @davutpolat ๊ณผ ๋์ผํ ์ค๋ฅ๋ก ์คํจํฉ๋๋ค. ๊ทธ์ ์๋ฃจ์ ์ ์ฌ์ฉํ๊ณ ์ถ์์ง๋ง /wrapper/libxgboostwrapper.so๋ฅผ ์ด๋์์ ์ฐพ์ ์ ์๋์ง ๋ชจ๋ฅด๊ฒ ์ต๋๋ค.
@claygirl ์์คํ ์ gcc ๋๋ clang์ด ์์ต๋๊น? ์์คํ ํ๊ฒฝ๊ณผ ์ค๋ฅ ๋ฉ์์ง๋ ์๋ ค์ฃผ์ญ์์ค.
ํด๊ฒฐ์ฑ
. ๋์ผํ OSError๊ฐ ์์ต๋๋ค: /usr/local/lib/libxgboostwrapper.so: ๊ณต์ ๊ฐ์ฒด ํ์ผ์ ์ด ์ ์์ต๋๋ค: ํด๋น ํ์ผ์ด๋ ๋๋ ํฐ๋ฆฌ๊ฐ ์์ต๋๋ค. ๋๋ ๋ณต์ฌํ๋ค
site-packages/xgboost-0.4-py2.7.egg/xgboost/./wrapper/libxgboostwrapper.so๋ฅผ /usr/local/lib/๋ก ์ด๋ํ๊ณ ์๋ํ๋ ๊ฒ ๊ฐ์ต๋๋ค.
๊ทธ๋ฌ๋ 2.7๊ณผ 3.4๊ฐ ๋ชจ๋ ์์ผ๋ฏ๋ก ๋ง์กฑํ์ง ์์ต๋๋ค. ..์๋ก์ด ํด๊ฒฐ์ฑ
์ด ์์ต๋๊น?
@dsivakumar site-packages/xgboost-0.4-py2.7.egg/xgboost/./wrapper๋ pip๋ก ์ค์นํ๊ณ xgboost/lib_path.py๊ฐ ์ด ๊ฒฝ๋ก๋ฅผ ํฌํจํ๋ฏ๋ก import xgboost
์ธ ๊ฒฝ์ฐ libxgboostwrapper.so์ ์์ ์์น์
๋๋ค.
@phunterlau ๊ฐ์ฌํฉ๋๋ค, ๊ทธ๊ฒ์ด ์ ์ผํ ํด๊ฒฐ์ฑ ์ธ ๊ฒ ๊ฐ์ต๋๋ค.
์ฌ๋ฌ ๋ฒ ์๋ํ์ง๋ง Windows OS PC์ xgboost๋ฅผ ์ค์นํ๋ ค๋ ํฌ๋ง์ ์์์ต๋๋ค.
ํ์ง๋ง ์ง๊ธ ๋น์ ์ ๋ฌด์์ ํด์ผํ ์ง ๋์ธ ๊ฒ์
๋๋ค
๊ทธ๊ฒ์ ์ค๋ฅ์
๋๋ค
C:UsersSander> pip install xgboost
xgboost ์์ง
xgboost-0.4a30.tar.gz ๋ค์ด๋ก๋(753kB)
100% |##################################| 753kB 397kB/s
ํ์ผ/๋๋ ํ ๋ฆฌ ์์
c:userssanderappdatalocaltemppip-build-gqsijfxgbo
ostpip-egg-info(PKG-INFO์์)
๋๋ ์๋์ฝ๋ค ํ์ด์ฌ ์ค์น๋ฅผ ์ฌ์ฉํฉ๋๋ค
kaggle ๋ํ์์ ๋๊ตฐ๊ฐ xgboos ์ค์น์ ์คํจํ๊ณ
๋ค๋ฅธ ๊ธฐ์ ์ ์ ํํ๊ณ ๊ทธ๋ 2 ์๋ฅผ ์ป์์ต๋๋ค ...
2016๋ 1์ 7์ผ ๋ชฉ์์ผ ์ค์ 3์ 31๋ถ์ dsivakumar [email protected] ์์ ๋ค์๊ณผ ๊ฐ์ด ์ผ์ต๋๋ค.
@phunterlau https://github.com/phunterlau ๊ฐ์ฌํฉ๋๋ค.
ํด๊ฒฐ์ฑ .โ
์ด ์ด๋ฉ์ผ์ ์ง์ ๋ต์ฅํ๊ฑฐ๋ GitHub์์ ํ์ธํ์ธ์.
https://github.com/dmlc/xgboost/issues/463#issuecomment -169595600.
@Sandy4321 Windows๋ ์ค์น ๊ฐ์ด๋ ๋ฐ ๋ฌธ์ ํด๊ฒฐ์ ์ธ๊ธ๋ ๋๋ก VS ๋ช
๋ น์ค ์ปดํ์ผ๋ฌ์ ๋ํด ์ค์ ๋์ง ์์๊ธฐ ๋๋ฌธ์ ํ์ฌ pip ์ค์น๋ฅผ ์ง์ํ์ง ์์ต๋๋ค. windows/
์ VS ์๋ฃจ์
ํ์ผ์ ์ฌ์ฉํ์ฌ ์ปดํ์ผํ๊ณ ์ค์นํ์ญ์์ค. 2๋ฑ์ ํ๋ ๋ฐ ๋์์ด ๋๊ธธ ๋ฐ๋๋๋ค :-)
Xcode๊ฐ ์๋ Mac 10.10.5์ Xgboost๋ฅผ ์ค์นํ๋ ค๊ณ ํฉ๋๋ค. ๋จผ์ brew install gcc --without-multilib๋ฅผ ํตํด openmp๋ฅผ ์ง์ํ๋ GCC 5.3์ ์ค์นํ์ต๋๋ค. ๋์งธ, xgboost๋ฅผ ๋ค์๊ณผ ๊ฐ์ด ๋น๋ํฉ๋๋ค.
์์ ํด๋ก --์ฌ๊ท https://github.com/dmlc/xgboost
CD xgboost
๋ด๋ณด๋ด๊ธฐ CC=/usr/local/bin/gcc-5
๋ด๋ณด๋ด๊ธฐ CXX=/usr/local/bin/g++-5
cp make/config.mk ./config.mk
-j4๋ฅผ ๋ง๋ค๋ค
๊ทธ๋ผ ์๋์ ๊ฐ์ด ์๋ฌ๊ฐ ๋จ๋๋ฐ,
make: ** [lib/libxgboost.a] ์ค๋ฅ 1make: * * ๋๋์ง ์์ ์์
์ ๊ธฐ๋ค๋ฆฌ๋ ์ค....
clangclang: : ๊ฒฝ๊ณ : ๊ฒฝ๊ณ : ์ปดํ์ผํ๋ ๋์ ์ฌ์ฉ๋์ง ์์ ์ธ์: '-pthread'
์ปดํ์ผํ๋ ๋์ ์ฌ์ฉ๋์ง ์์ ์ธ์: '-pthread'
ld: -lgomp์ ๋ํ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ฐพ์ ์ ์์ต๋๋ค.
ld: -lgomp์ ๋ํ ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ฐพ์ ์ ์์ต๋๋ค.
clang: ์ค๋ฅ: ๋ง์ปค ๋ช
๋ น์ด ์ข
๋ฃ ์ฝ๋ 1๊ณผ ํจ๊ป ์คํจํ์ต๋๋ค(ํธ์ถ์ ๋ณด๋ ค๋ฉด -v ์ฌ์ฉ).
clang: ์ค๋ฅ: ๋ง์ปค ๋ช
๋ น์ด ์ข
๋ฃ ์ฝ๋ 1๊ณผ ํจ๊ป ์คํจํ์ต๋๋ค(ํธ์ถ์ ๋ณด๋ ค๋ฉด -v ์ฌ์ฉ).
make: ** [lib/libxgboost.so] ์ค๋ฅ 1make: * * [xgboost] ์ค๋ฅ 1
๋๋ ์ค๋ฅ๋ฅผ ๋ฌด์ํ๊ณ ๊ณ์ ์งํํ๋ค. ๋๋ ์๋์ ๊ฐ์ด ์ฝ๋๋ฅผ ์
๋ ฅํ๋ค
sudo ./build.sh
๊ทธ๋ฌ๋๋
clang: ๊ฒฝ๊ณ : ์ปดํ์ผํ๋ ๋์ ์ฌ์ฉ๋์ง ์์ ์ธ์: '-pthread'
๋จ์ผ ์ค๋ ๋ xgboost ๋น๋ ์ฑ๊ณต
OpenMP์ ํจ๊ป GCC 5๋ฅผ ์ค์นํ์ง๋ง ์ฌ์ ํ ๋จ์ผ ์ค๋ ๋ Xgboost์ธ ์ด์ ๋ฅผ ์๋ ค์ฃผ์๊ฒ ์ต๋๊น?
์ค์นํ Xgboost๋ฅผ ๋ค์ค ์ค๋ ๋ ๋ฒ์ ์ผ๋ก ๋ณ๊ฒฝํ๋ ค๋ฉด ์ด๋ป๊ฒ ํด์ผ ํฉ๋๊น?
์ต๊ทผ makefile์ clang-omp์์ ๋ ์ ์๋ํฉ๋๋ค.
์๋
ํ์ธ์, ๋ต๋ณ ์ฃผ์
์ ๋๋จํ ๊ฐ์ฌํฉ๋๋ค.
์ด์ xgboost์ gcc๊ฐ ํ์ํ์ง ์์ผ๋ฉฐ ์ปดํ์ผ๋ฌ๋ก์์ clang๋ ๋ค์ค ์ค๋ ๋๋ฅผ ์ง์ํ ์ ์๋ค๋ ๋ป์ด๊ฒ ์ฃ ? MAC 10.9 ์ด์์ clang๊ณผ ํจ๊ป ์ ๊ณต๋๋ฏ๋ก ์ฌ์ ํ homebrew์์ clang-omp๋ฅผ ๋ค์ด๋ก๋ํด์ผ ํฉ๋๊น?
์ ๋ ์ด๋ณด์์
๋๋ค xgboost๋ ์ด ์น์ฌ์ดํธ์ ๋ฐฉ๋ฒ๋๋ก ์ค์นํ๋๋ฐ ์ง๊ธ ์
๋ฐ์ดํธ๋ ์ค์น ๊ฐ์ด๋๊ฐ ์์ต๋๊น?์ค์ ๋ฐฉ๋ฒ์ ์๋ ค์ฃผ์ค ์ ์์ต๋๊น?
๋ํ clang-omp๋ก ์ ํํ ํ ์ด๋ฏธ ์ค์น๋ xgboost๋ฅผ ๋จผ์ ์ญ์ ํ๊ณ xgboost๋ฅผ ๋ค์ ์ค์นํด์ผ ํฉ๋๊น?
๊ฐ์ฌ ํด์!
2016-04-03 01:34:37์์ "Hongliang Liu" [email protected] ์์ ๋ค์๊ณผ ๊ฐ์ด ์ผ์ต๋๋ค.
์ต๊ทผ makefile์ clang-omp์์ ๋ ์ ์๋ํฉ๋๋ค.
โ
๋น์ ์ด ๋๊ธ์ ๋ฌ์๊ธฐ ๋๋ฌธ์ ์ด๊ฒ์ ๋ฐ๋ ๊ฒ์
๋๋ค.
์ด ์ด๋ฉ์ผ์ ์ง์ ๋ต์ฅํ๊ฑฐ๋ GitHub์์ ํ์ธํ์ธ์.
๋น ๋ฅธ ํ์ ์ ์ํด Thx. ๊ทํ์ ์ ์์ ๋ฐ๋ผ homebrew๋ฅผ ํตํด clang-omp๋ฅผ ๋ค์ด๋ก๋ํ์ต๋๋ค.
๊ทธ๋ ๋ค๋ฉด ๋ค์ ๋จ๊ณ๋ ๋ฌด์์
๋๊น? ํ์ฌ xgboost๋ฅผ ์ ๊ฑฐํ๊ณ ๋์ ๋ค์ ์ค์นํด์ผ ํ๋์ง ์ฌ๋ถ.
config.mk์ ๊ธฐ๋ณธ ์ปดํ์ผ๋ฌ๋ฅผ clang-omp๋ก ๋ณ๊ฒฝํ์ญ์์ค. ๋น๋ ์ง์นจ Mac OS X ๋ถ๋ถ์ ๋ฐ๋ฅด์ญ์์ค.
๋น์ ์ ์ง์์ ๋ํ Thx. ๊ทธ๋ฆฌ๊ณ config.mk์ ๊ธฐ๋ณธ ์ปดํ์ผ๋ฌ๋ฅผ ์ด๋ ๊ฒ clang-omp๋ก ๋ณ๊ฒฝํ์ต๋๋ค.
` ๋ด๋ณด๋ด๊ธฐ CC = /usr/local/bin/clang-omp
๋ด๋ณด๋ด๊ธฐ CXX = /usr/local/bin/clang-omp++
ADD_CFLAGS = -fopenmp`
๊ทธ๋ฐ ๋ค์ ๋๋ ๋ค์๊ณผ ๊ฐ์ด ์ปดํ์ผํฉ๋๋ค.
make -j8
๊ทธ๋ฌ๋ ์ค๋ฅ๊ฐ ๋ค์ ๋ํ๋ฉ๋๋ค.
make: ** [lib/libxgboost.a] ์ค๋ฅ 1make: * * ๋๋์ง ์์ ์์
์ ๊ธฐ๋ค๋ฆฌ๋ ์ค....
clang-3.5clang-3.5: : ์ค๋ฅ ์ค๋ฅ: : ํด๋น ํ์ผ ๋๋ ๋๋ ํฐ๋ฆฌ ์์: 'rabit/lib/librabit.a'ํด๋น ํ์ผ ๋๋ ๋๋ ํฐ๋ฆฌ ์์: 'rabit/lib/librabit.a'
make: ** [lib/libxgboost.so] ์ค๋ฅ 1make: * * [xgboost] ์ค๋ฅ 1
๋์๊ฒ ๋ฌธ์ ๊ฐ ์์ต๋๊น?
๊ทธ๋ฆฌ๊ณ ๋๋ ๋ฌ๋ฆฐ๋ค
sudo ./build.sh
์ค๋ฅ๋ ์๋์ ๊ฐ์ด ๋ํ๋ฉ๋๋ค
include/dmlc/omp.h:13:9: ๊ฒฝ๊ณ : ๊ฒฝ๊ณ : OpenMP๋ฅผ ์ฌ์ฉํ ์ ์์ต๋๋ค. ํ๋ก์ ํธ๋
๋จ์ผ ์ค๋ ๋ ์ฝ๋๋ก ์ปดํ์ผ๋ฉ๋๋ค. OpenMP ์ง์ ์ปดํ์ผ๋ฌ๋ฅผ ์ฌ์ฉํ์ฌ
๋ฉํฐ์ค๋ ๋ฉ์ ์ฅ์ . [-W#pragma-messages]pragma message("๊ฒฝ๊ณ : OpenMP๋ฅผ ์ฌ์ฉํ ์ ์์ต๋๋ค. "
clang-omp
๋ฅผ brew remove clang-omp; brew install clang-omp
๋ก ๋ค์ ์ค์นํด ๋ณด์ญ์์ค. config.mk
์์ ์ด ๋ ์ค( ADD_FLAG
์์)๋ง ๋ณ๊ฒฝํ๊ณ Makefile
์ ๋์ผํ ๋๋ ํ ๋ฆฌ์ ๋ณต์ฌํด์ผ ํฉ๋๋ค.
export CC = clang-omp
export CXX = clang-omp++
make
์คํ
Windows 7 ์ฌ์ฉ. yhat Rodeo์ Anaconda.
xgboost๋ฅผ ์ค์นํ๋ ค๊ณ ํ๋ฉด ๋ค์ ์ค๋ฅ๊ฐ ๋ฐ์ํฉ๋๋ค. ๋์์ฃผ์ธ์.
`! ํ ์ค์น xgboost
xgboost ์์ง
์บ์๋ xgboost-0.4a30.tar.gz ์ฌ์ฉ
C:UsersUSERAppDataLocalTemppip-build-dkmqc8n1xgboostpip-egg-info(PKG-INFO์์)`์ ํ์ผ/๋๋ ํ ๋ฆฌ๊ฐ ์์ต๋๋ค.
๊ทํ์ ์ ์์ ๋ํด @phunterlau Thx. ๊ทํ์ ์ง์๋ฅผ ์๋ํ์ง๋ง ๋ค์ ์ค๋ฅ๊ฐ ๋ฐ์ํ์ต๋๋ค. ์ ์์ ํด์ฃผ์ธ์.
๋๋ clang-imp๋ฅผ ๋ค์ ์ค์นํ๊ณ Makefile์ด ์๋ ๋์ผํ ๋๋ ํ ๋ฆฌ์ config.mk์์ ๋ ์ค(ADD_FLAG ์์)์ ๋ณ๊ฒฝํ์ต๋๋ค.
export CC = clang-omp
export CXX = clang-omp++
๊ทธ๋ฐ ๋ค์ sudo make -j4
์ ์คํํ๊ณ ๋ค์ ์ค๋ฅ๊ฐ ๋ฐ์ํ์ต๋๋ค.
ar crv lib/libxgboost.a
ar: no archive members specified
usage: ar -d [-TLsv] archive file ...
ar -m [-TLsv] archive file ...
ar -m [-abiTLsv] position archive file ...
ar -p [-TLsv] archive [file ...]
ar -q [-cTLsv] archive file ...
ar -r [-cuTLsv] archive file ...
ar -r [-abciuTLsv] position archive file ...
ar -t [-TLsv] archive [file ...]
ar -x [-ouTLsv] archive [file ...]
make: *** [lib/libxgboost.a] Error 1
make: *** Waiting for unfinished jobs....
clang-3.5: warning: argument unused during compilation: '-pthread'
clang-3.5: warning: argument unused during compilation: '-pthread'
๊ทธ๋ฐ ๋ค์ sudo ./build.sh
๋ฅผ ์คํํ๊ณ ๋ค์ ์ค๋ฅ๊ฐ ๋ฐ์ํฉ๋๋ค.
ar crv lib/libxgboost.a
ar: no archive members specified
usage: ar -d [-TLsv] archive file ...
ar -m [-TLsv] archive file ...
ar -m [-abiTLsv] position archive file ...
ar -p [-TLsv] archive [file ...]
ar -q [-cTLsv] archive file ...
ar -r [-cuTLsv] archive file ...
ar -r [-abciuTLsv] position archive file ...
ar -t [-TLsv] archive [file ...]
ar -x [-ouTLsv] archive [file ...]
make: *** [lib/libxgboost.a] Error 1
-----------------------------
Building multi-thread xgboost failed
์๋
ํ์ธ์ ์ฌ๋ฌ๋ถ,
Python์ ์ฌ์ฉํ์ฌ Windows์ Xgboost๋ฅผ ์ค์นํ๋ ค๋ฉด ๋ค์ ์ค๋ ๋์ ์ง์นจ์ ๋ฐ๋ฅด์ญ์์ค.
@boral ๋ค, ํ์ฌ pip ์ค์น๋ ์ฐฝ ํ๋ซํผ์ ์ง์ํ์ง ์์ต๋๋ค. ๋น์ ์ด ์์ ๋ธ ๊ฒ์ ๊ธฐ์๊ฒ ์๊ฐํฉ๋๋ค
@liyanjin ํต์ฌ ๋ถ๋ถ์ ๋ํด 'make xgboost'๋ฅผ ์ํํ ์ ์์ต๋๋ค. ar๋ฅผ ์ฌ์ฉํ๋ ค๋ฉด Mac์ฉ ar๋ฅผ ์ค์นํด์ผ ํ ์๋ ์์ต๋๋ค.
๋๋ ๋น์ทํ ๋ฌธ์ ์ ์ง๋ฉดํ๊ณ ์์ต๋๋ค. ๋ด ์ค๋ฅ๋ ๊ฝค
OSError: dlopen(/Users/mlal/anaconda/lib/python2.7/site-packages/libxgboostwrapper.so, 6): Library not loaded: @rpath/./libgomp.1.dylib
Referenced from: /Users/mlal/anaconda/lib/python2.7/site-packages/libxgboostwrapper.so
Reason: image not found
gcc๊ฐ ์ค์น๋์ด ์๋์ง ํ์ธํ์ต๋๋ค.
$ ์์กฐ ์ค์น gcc49
๊ฒฝ๊ณ : homebrew/versions/gcc49-4.9.3์ด ์ด๋ฏธ ์ค์น๋์์ต๋๋ค.
์ ๋ Mac OS๋ฅผ ์ฌ์ฉ ์ค์ ๋๋ค. ์๋์ฝ๋ค๋ฅผ ํตํด xgboost๋ฅผ ์ค์นํ์ต๋๋ค.
@lalmanisha Mac์ ์ฌ์ฉ ์ค์ด๋ผ๊ณ ์๊ฐํฉ๋๋ค. Mac์ ํ์ฌ ๋ชจ๋ฒ ์ฌ๋ก๋ gcc
clang-omp
๋ฅผ ์ฌ์ฉํ๋ ๊ฒ์
๋๋ค. brew์์ clang-omp
๋ฅผ ์ค์นํ๊ณ config.mk์ CC ๋ฐ CXX๋ฅผ clang-omp๋ก ๋ณ๊ฒฝํ ์ ์์ต๋๊น?
๋ต์ฅ์ ๋ณด๋ด ์ฃผ์
์ ๊ฐ์ฌํฉ๋๋ค. ์ฌ์ ํ ๊ฐ์ ์ค๋ฅ ๋ฉ์์ง๊ฐ ๋ํ๋ฉ๋๋ค. ์ฌ๊ธฐ
`---------------------------------------------------- ----------------------
OSError Traceback(๊ฐ์ฅ ์ต๊ทผ ํธ์ถ ๋ง์ง๋ง)
14 # ํ์ฌ ๋๋ ํ ๋ฆฌ์ ์ฐ๋ ๋ชจ๋ ๊ฒฐ๊ณผ๋ ์ถ๋ ฅ์ผ๋ก ์ ์ฅ๋ฉ๋๋ค.
15
---> 16 xgboost๋ฅผ xgb๋ก ๊ฐ์ ธ์ค๊ธฐ
sklearn.linear_model ๊ฐ์ ธ์ค๊ธฐ LogisticRegression์์ 17
18 ํ๋ค๋ฅผ pd๋ก ๊ฐ์ ธ์ค๊ธฐ
/Users/mlal/anaconda/lib/python2.7/site-packages/xgboost.py
80
81 # XGBoost ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ ์ญ์ ์ผ๋ก ๋ก๋
---> 82 xglib = load_xglib()
83
84
/Users/mlal/anaconda/lib/python2.7/site-packages/xgboost.py in load_xglib()
57 len(dll_path) == 0์ธ ๊ฒฝ์ฐ:
58 raise XGBoostLibraryNotFound(' ํ๋ณด ๊ฒฝ๋ก์์ ํ์ผ์ ์ฐพ์ ์ ์์ ' + str(dll_path))
---> 59 ๋ผ์ด๋ธ๋ฌ๋ฆฌ = ctypes.cdll.LoadLibrary(lib_path[0])
60
61 # DMatrix ํจ์
/Users/mlal/anaconda/lib/python2.7/ctypes/ LoadLibrary(์์ฒด, ์ด๋ฆ)์ init .pyc
441
442 def LoadLibrary(์์ , ์ด๋ฆ):
--> 443 ๋ฐํ self._dlltype(์ด๋ฆ)
444
445 ๅฏๅ = ็ฒๅ
/Users/mlal/anaconda/lib/python2.7/ctypes/ init .pyc in init (self, name, mode, handle, use_errno, use_last_error)
363
364 ํธ๋ค์ด ์์์ธ ๊ฒฝ์ฐ:
--> 365 self._handle = _dlopen(self._name, ๋ชจ๋)
366 ๊ธฐํ:
367*
OSError: dlopen(/Users/mlal/anaconda/lib/python2.7/site-packages/libxgboostwrapper.so, 6): ๋ผ์ด๋ธ๋ฌ๋ฆฌ๊ฐ ๋ก๋๋์ง ์์: @rpath/./libgomp.1.dylib
์ฐธ์กฐ: /Users/mlal/anaconda/lib/python2.7/site-packages/libxgboostwrapper.so
์ด์ : ์ด๋ฏธ์ง๋ฅผ ์ฐพ์ ์ ์์
`
config.mk ํ์ผ์ ์๋์ ๊ฐ์ด ๋ณ๊ฒฝํ์ต๋๋ค.
์ปดํ์ผ๋ฌ ์ ํ
๋ด๋ณด๋ด๊ธฐ CC = clang-omp
๋ด๋ณด๋ด๊ธฐ CXX = clang-omp
๋ด๋ณด๋ด๊ธฐ MPICXX = mpicxx
sudo make -j4
ar crv ๋ผ์ด๋ธ๋ฌ๋ฆฌ/libxgboost.a
ar: ์์นด์ด๋ธ ๋ฉค๋ฒ๊ฐ ์ง์ ๋์ง ์์์ต๋๋ค.
์ฌ์ฉ๋ฒ: ar -d [-TLsv] ์์นด์ด๋ธ ํ์ผ ...
ar -m [-TLsv] ์์นด์ด๋ธ ํ์ผ ...
ar -m [-abiTLsv] ์์น ์์นด์ด๋ธ ํ์ผ ...
ar -p [-TLsv] ์์นด์ด๋ธ [ํ์ผ ...]
ar -q [-cTLsv] ์์นด์ด๋ธ ํ์ผ ...
ar -r [-cuTLsv] ์์นด์ด๋ธ ํ์ผ ...
ar -r [-abciuTLsv] ์์น ์์นด์ด๋ธ ํ์ผ ...
ar -t [-TLsv] ์์นด์ด๋ธ [ํ์ผ ...]
ar -x [-outTLsv] ์์นด์ด๋ธ [ํ์ผ ...]
make: ** [lib/libxgboost.a] ์ค๋ฅ 1make: * * ๋๋์ง ์์ ์์
์ ๊ธฐ๋ค๋ฆฌ๋ ์ค....
clang: clang: ์ค๋ฅ: ์ค๋ฅ: ์ง์๋์ง ์๋ ์ต์
'-fopenmp' ์ง์๋์ง ์๋ ์ต์
'-fopenmp'
make: ** [lib/libxgboost.so] ์ค๋ฅ 1make: * * [xgboost] ์ค๋ฅ 1
๋ด๊ฐ ๋ฌ๋ ธ์ ๋
sudo ./build.sh
maker.o ๋น๋/ํธ๋ฆฌ/updater_sync.o dmlc-core/libdmlc.a rabit/lib/librabit_empty.a -pthread -lm
clang: ๊ฒฝ๊ณ : ์ปดํ์ผํ๋ ๋์ ์ฌ์ฉ๋์ง ์์ ์ธ์: '-pthread'
๋จ์ผ ์ค๋ ๋ xgboost ๋น๋ ์ฑ๊ณต
๋ฉํฐ ์ฐ๋ ๋ ๋ฒ์ ์ ์ํ์ ๋ค๋ฉด
doc/build.md์ ์ถ๊ฐ ์ง์นจ์ ์ฐธ์กฐํ์ธ์.
์ฌ์ ํ ๊ฐ์ ์ค๋ฅ๊ฐ ๋ฐ์ํฉ๋๋ค.
dlopen(/Users/mlal/anaconda/lib/python2.7/site-packages/libxgboostwrapper.so, 6): ๋ผ์ด๋ธ๋ฌ๋ฆฌ๊ฐ ๋ก๋๋์ง ์์: @rpath/./libgomp.1.dylib
์ฐธ์กฐ: /Users/mlal/anaconda/lib/python2.7/site-packages/libxgboostwrapper.so
์ด์ : ์ด๋ฏธ์ง๋ฅผ ์ฐพ์ ์ ์์
์ข์์, ์์ ๋์๋ง๊ณผ build.md์ ์กฐํฉ์ด xgboost ์๋์ ๋์์ด ๋ ๊ฒ ๊ฐ์ต๋๋ค. ๋ค๋ค ๊ฐ์ฌ ํด์ !
@lalmanisha ๋ ํ์ด์ฌ ํจํค์ง๋ง ํ์ํ๊ธฐ ๋๋ฌธ์ ar
๊ฐ ํ์ํ ๋ณ๋ ฌ ๋ฐ ์์ฌ ๋ฒ์ ๊ณผ ๊ฐ์ ๋ค๋ฅธ ๋ถํ์ํ ํจํค์ง๋ฅผ ์ ๊ฑฐํ๋ make xgboost
๋ง ํ ์ ์์ต๋๋ค. make
์ฑ๊ณตํด์ผ ํฉ๋๋ค. ๊ทธ๋ฆฌ๊ณ ํด๊ฒฐํ์
จ๋ค๋ ๋คํ์
๋๋ค.
MAC์ git clone
๋ก Xgboost๋ฅผ ์ค์นํด ๋ณด์ญ์์ค. ์ด ๋ต๋ณ ์ด ๋์ฌ ๋๊น์ง @LiyanJin ์ ๋ชจ๋ ์ง์นจ์ ๋ฐ๋ฆ
๋๋ค. ๋ฉํฐ ์ค๋ ๋ฉ์ ์ฌ์ฉํ๊ธฐ ์ํด homebrew๋ฅผ ํตํด clang-omp๋ฅผ ๋ค์ด๋ก๋ํ์ต๋๋ค.
export CC = clang-omp
export CXX = clang-omp++
export MPICXX = mpicxx
clang-omp++ -std=c++0x -Wall -O3 -msse2 -Wno-unknown-pragmas -funroll-loops -Iinclude -fopenmp -Idmlc-core/include -Irabit/include -fPIC -fopenmp -MM -MT build/learner.o src/learner.cc >build/learner.d
In file included from src/learner.cc:7:
In file included from include/xgboost/logging.h:11:
In file included from dmlc-core/include/dmlc/logging.h:10:
/usr/local/Cellar/clang-omp/2015-04-01/libexec/bin/../include/c++/v1/cstdio:100:10: fatal error: 'stdio.h' file not found
#include <stdio.h>
^
1 error generated.
make: *** [build/learner.o] Error 1
pip install
์ ์๋ํ์ง๋ง ํ์ด์ฌ ํจํค์ง์ ์ต์ ๊ธฐ๋ฅ์ ๊ฐ๊ณ ์ถ์ต๋๋ค.
๋ช ๊ฐ์ง ํ?
ํธ์ง : ์๋ฃจ์
์ ์ฐพ์ผ์ญ์์ค. xcode-select --install
๋ฐ make
์
๋๋ค. ๋ค๋ฅธ ๋์์ด ๋๊ธฐ๋ฅผ ๋ฐ๋๋๋ค.
@armgilles ๋ง์ต๋๋ค: ๊ธฐ๋ณธ์ ์ผ๋ก mac์ ํค๋๊ฐ ์๋ ์ปดํ์ผ๋ฌ๋ฅผ ์ค์นํ์ง ์์ ๋ฐ๋ฉด clang-omp
๋ ๋ก์ปฌ์ ์ค์น๋ Xcode๊ฐ ํ์ํ๋ฉฐ xcode-select --install
๋ก ์ค์นํ๋ฉด ์ ์์คํ
์ผ๋ก ์
๊ทธ๋ ์ด๋ํ ํ ๋ชจ๋ ๊ฒ์ด ๋ฌธ์ ๋ฅผ ํด๊ฒฐํ ์ ์์ต๋๋ค. .
๋๋ ๊ทธ๊ฒ์ ์ฒ์๋ถํฐ ๋ง๋ค์ด์ผ ํ๋ค:
git clone --recursive https://github.com/dmlc/xgboost.git
cd xgboost
./build.sh
pip install -e python-package
hnykda ์ ์์ Ubuntu 16.0.4์์ ์ ์๊ฒ ํจ๊ณผ์ ์ด์์ต๋๋ค.
@phunterlau
๊ฐ์ ์ค๋ฅ๊ฐ ๋ฐ์ํ์ต๋๋ค.
ar crv ๋ผ์ด๋ธ๋ฌ๋ฆฌ/libxgboost.a
ar: ์์นด์ด๋ธ ๋ฉค๋ฒ๊ฐ ์ง์ ๋์ง ์์์ต๋๋ค.
์ฌ์ฉ๋ฒ: ar -d [-TLsv] ์์นด์ด๋ธ ํ์ผ ...
ar -m [-TLsv] ์์นด์ด๋ธ ํ์ผ ...
ar -m [-abiTLsv] ์์น ์์นด์ด๋ธ ํ์ผ ...
ar -p [-TLsv] ์์นด์ด๋ธ [ํ์ผ ...]
ar -q [-cTLsv] ์์นด์ด๋ธ ํ์ผ ...
ar -r [-cuTLsv] ์์นด์ด๋ธ ํ์ผ ...
ar -r [-abciuTLsv] ์์น ์์นด์ด๋ธ ํ์ผ ...
ar -t [-TLsv] ์์นด์ด๋ธ [ํ์ผ ...]
ar -x [-outTLsv] ์์นด์ด๋ธ [ํ์ผ ...]
make: * [lib/libxgboost.a] ์ค๋ฅ 1
๋๋ ar๋ฅผ ์ค์นํ์ต๋๋ค. ๋ค๋ฅธ ๋ช
๋ น์ ์ฌ์ฉํ์ฌ ๋์ฒดํ ์ ์๋ค๋ฉด "ar crv"๊ฐ ๋ฌด์์ ํ๋์ง ๊ถ๊ธํฉ๋๋ค.
๋น์ ์ " @liyanjin ๋น์ ์ ํต์ฌ ๋ถ๋ถ์ ๋ํด 'make xgboost'๋ฅผ ํ ์ ์์ต๋๋ค. ar๋ฅผ ๊ฐ์ง๋ ค๋ฉด Mac์ฉ ar๋ฅผ ์ค์นํด์ผ ํ ์๋ ์์ต๋๋ค"๋ผ๊ณ ์ธ๊ธํ์ง๋ง "ํต์ฌ ๋ถ๋ถ์ ๋ํด 'make xgboost'๋ฅผ ์ํ"ํ๋ ๊ฒ์ ์ดํดํ์ง ๋ชปํฉ๋๋ค. ์๋จ. ๋น์ ์ ์กฐ์ธ์ ๋ฐ๋๋๋ค
๋ค์์ ํตํด ๋ด MAC(macOS 10.12.3)์ ํจํค์ง๋ฅผ ์ฑ๊ณต์ ์ผ๋ก ์ค์นํ์ต๋๋ค.
brew install --with-clang llvm
brew install cmake
brew install gcc --without-multilib
git clone --recursive https://github.com/dmlc/xgboost
cd xgboost; cp make/config.mk ./config.mk; make -j4
cd python-package/ ; python setup.py install
@hnykda ๋ง์ ๊ฒฝ์ฐ์ ์๋ํ๋ ์๋ฃจ์ ์ ๊ฒ๋ณด๊ธฐ์๋ ๋จ์ํด ๋ณด์ ๋๋ค. ๊ณ ๋ง์.
๋๋ฅผ ์ํด ์ผํ ์๋ฃจ์
์
/home/username/anaconda3/lib/python3.5/site-packages/xgboost
./build-python.sh ์คํ
xgboost๋ฅผ ์ค์นํ ๋ ๋ง์ ๋ฌธ์ ๊ฐ ์๋ ๊ฒ ๊ฐ์ต๋๋ค. Mac์ ์ค์นํ๋ ค๊ณ ์๋ํ์ง๋ง ์คํจํ์ต๋๋ค. osmeone์ด ์ต์ข ์๋ฃจ์ ์ด ๋ฌด์์ธ์ง ๋งํด ์ค ์ ์์ต๋๊น?
๋๋ฅผ ์ํด ์ผํ ๊ฒ์ Linux์ ๋ค์์ ์ถ๊ฐํ๋ ๊ฒ์ด ์์ต๋๋ค ... ์ ์ฉ (์์ ๋ชจ๋ ์ฌ๋)
git clone --recursive https://github.com/dmlc/xgboost.git
cd xgboost
./build.sh
pip install -e python-package
cd python-package
python setup.py install
์ ๋ฅผ ์ํด MacOS Sierra์์ ์์
ํ ํ:
brew install gcc --without-multilib
์ด ๋ช ๋ น์ ์คํ:
export CC=gcc-7
export CXX=g++-7
@philipshurpik ๊ฐ์ฌํฉ๋๋ค!
@philipshurpik ๊ทธ๊ฒ์ ์ ์๊ฒ ๋งค์ฐ ํจ๊ณผ์ ์ด์์ต๋๋ค. ๊ฐ์ฌํฉ๋๋ค!
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
๋๋ ๊ทธ๊ฒ์ ์ฒ์๋ถํฐ ๋ง๋ค์ด์ผ ํ๋ค: