Hi,
I trained a model in a computer and now I am trying to put it in a r-pi, but I am not able to download the package. My intention is only to predict some values using the model, built in a more powerful pc.
I did follow the two possible ways recommended in the Github but I failed in both. I copy all the methods and errors obtained:
My steps here are a mix of some steps I read:
git clone --recursive https://github.com/dmlc/xgboost
cd xgboost
I read to modify the Makefile
by deleting -msse2 flag, and I did it to allow make
command to be launched. After that I did:
cp make/minimum.mk ./config.mk
make -j4
sudo ./build.sh
cd python-package
sudo python setup.py install
And the results obtained:
pi@raspberrypi:~/xgboost/python-package $ sudo python setup.py install
Traceback (most recent call last):
File "setup.py", line 19, in <module>
LIB_PATH = [os.path.relpath(libfile, CURRENT_DIR) for libfile in libpath['find_lib_path']()]
File "xgboost/libpath.py", line 46, in find_lib_path
'List of candidates:\n' + ('\n'.join(dll_path)))
__builtin__.XGBoostLibraryNotFound: Cannot find XGBoost Library in the candidate path, did you install compilers and run build.sh in root path?
List of candidates:
/home/pi/xgboost/python-package/xgboost/libxgboost.so
/home/pi/xgboost/python-package/xgboost/../../lib/libxgboost.so
/home/pi/xgboost/python-package/xgboost/./lib/libxgboost.so
/usr/xgboost/libxgboost.so
Thanks in advance
remove -msse2 flag in compilation
That's what I did before @tqchen. The output after the sudo python setup.py install
is the one in the question
Thanks
make sure you can xgboost library build outputted in the candidate path, it is likely that the build is not successful
I think the problem comes from 'sudo build.sh': you don't have to 'sudo', otherwise it may build the .so somewhereelse
Forgot to mention: just make with the modified .mk, no need to run 'build.sh' since it just calls make again
Okay, thanks for your answers @tqchen and @phunterlau , but problem is still there. Now I am trying to install it at /usr/lib/python2.7/dist-packages/
from Git.
Even following the steps, the error is still the same:
pi@raspberrypi:/usr/lib/python2.7/dist-packages/xgboost/python-package $ sudo python setup.py install
Traceback (most recent call last):
File "setup.py", line 19, in <module>
LIB_PATH = [os.path.relpath(libfile, CURRENT_DIR) for libfile in libpath['find_lib_path']()]
File "xgboost/libpath.py", line 46, in find_lib_path
'List of candidates:\n' + ('\n'.join(dll_path)))
__builtin__.XGBoostLibraryNotFound: Cannot find XGBoost Library in the candidate path, did you install compilers and run build.sh in root path?
List of candidates:
/usr/lib/python2.7/dist-packages/xgboost/python-package/xgboost/libxgboost.so
/usr/lib/python2.7/dist-packages/xgboost/python-package/xgboost/../../lib/libxgboost.so
/usr/lib/python2.7/dist-packages/xgboost/python-package/xgboost/./lib/libxgboost.so
/usr/xgboost/libxgboost.so
Hello @xrr47, not sure if you've figured out the problem by now but I faced the same issue when compiling mine.
Apparently the build was reported as "successful" but actually not so. If you look at your compile log carefully you should see errors like,
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
That means your build did not include the necessary libraries thus your reported error.
Strangely this issue was supposedly fixed in #1932 but I still do not see the mentioned folders under xgboost/python-packages/, only under the main xgboost/ which is one level up. So I symlinked them and the build was completed without complaining, well, apart from no pyo and pyc files found.
I could then import xgboost in Jupyter and read in data via xgb.DMatrix but as soon as I start training the kernel crashes without giving an error. Any ideas? @tqchen @phunterlau
I figured it out. Below are step-by-step instructions that work as of today (Jan 14 2018) to install XGBoost for Python 3 on a Raspberry Pi 3 with the newest Raspian version (stretch).
First, update your system's package list by entering the following command:
sudo apt-get update
Next, upgrade all your installed packages to their latest versions with the command:
sudo apt-get dist-upgrade
Make sure the needed Python tools are installed:
sudo apt-get install python-setuptools
Then, in principle, you can follow the instructions here for Debian/Ubuntu:
http://xgboost.readthedocs.io/en/latest/build.html
However, an edit is necessary to one of the make files.
First, clone the GIT directory:
git clone --recursive https://github.com/dmlc/xgboost
In the subdirectory/xgboost/rabit/, edit Makefile, line 22, to get rid if the -msse2 flag. It should simply read:
export CFLAGS = -O3 $(WARNFLAGS)
Change back to the xgboost subdirectory, and type:
make -j4
During the make, the RPi2 will run on all barrels and may get too hot and freeze. That happened to me during the process. I had to open the box I have it in and blow at it with a fan!
To make and install the Python package (use Python3 to be sure it installs to the right Python):
cd python-package; sudo python3 setup.py install
Most helpful comment
I figured it out. Below are step-by-step instructions that work as of today (Jan 14 2018) to install XGBoost for Python 3 on a Raspberry Pi 3 with the newest Raspian version (stretch).
First, update your system's package list by entering the following command:
sudo apt-get update
Next, upgrade all your installed packages to their latest versions with the command:
sudo apt-get dist-upgrade
Make sure the needed Python tools are installed:
sudo apt-get install python-setuptools
Then, in principle, you can follow the instructions here for Debian/Ubuntu:
http://xgboost.readthedocs.io/en/latest/build.html
However, an edit is necessary to one of the make files.
First, clone the GIT directory:
git clone --recursive https://github.com/dmlc/xgboost
In the subdirectory/xgboost/rabit/, edit Makefile, line 22, to get rid if the -msse2 flag. It should simply read:
export CFLAGS = -O3 $(WARNFLAGS)
Change back to the xgboost subdirectory, and type:
make -j4
During the make, the RPi2 will run on all barrels and may get too hot and freeze. That happened to me during the process. I had to open the box I have it in and blow at it with a fan!
To make and install the Python package (use Python3 to be sure it installs to the right Python):
cd python-package; sudo python3 setup.py install