Hello, team. How are you?
My name is Jefferson, and I’m a student here in Brazil.
I’ve been using Home Assistant for some time now and am truly impressed with the amount of flexibility it offers in executing daily tasks in a straightforward manner. In one of my projects, I use a mathematical model (XGBoost) that I trained to gather sensor data and estimate various parameters for my project. To get this project working, I install an addon called AppDaemon, and in its configuration environment, I used to define the name of the XGBoost package in the (python_packages) section, and that was it. Everything was working:
system_packages:
- py3-numpy
- cmake
- build-base
- python3
- python3-dev
- gcc
- g++
python_packages:
- kafka-python
- joblib==1.3.1
- scikit-learn==1.3.2
- pandas==1.4.3
- xgboost
init_commands:
- python3 -c 'import numpy as np;'
init_commands: []
However, after a few months and several updates, when trying to do this, I receive an error indicating that the system does not recognize ‘mmap64’ - I believe it is a library for memory management in C++.
“tmp/pip-install-ji4xzb8c/xgboost_5bc73eb7ae8544b1bbb78e957c8e1faa/cpp_src/src/common/io.cc:260:38: error: 'mmap64' was not declared in this scope; did you mean 'mmap'?
260 | ptr = reinterpret_cast<std::byte*>(mmap64(nullptr, view_size, prot, MAP_PRIVATE, fd, view_start));
| ^~~~~~
| mmap”
And, because of this, I always receive the status:
“[15:29:18] FATAL: Failed installing package xgboost”
I have searched everywhere for a solution to the ‘mmap64’ issue with ‘xgboost’, installed dozens of packages that might help, and adjusted gcc, g++… But I can’t find a solution to successfully install XGBOOST on APPDAEMON for them to work together seamlessly.
Searching some forums and using chatgpt I found some suggestions, such as:
Install the packages:
mmap, libomp, libgomp, zlib, ninja, libomp-dev, zlib1g-dev, libgomp1, lib32stdc++6 ...
But none of these had a positive return.
Could someone with much more experience than me suggest how to resolve this?
Complete error:
-- Could NOT find Backtrace (missing: Backtrace_LIBRARY Backtrace_INCLUDE_DIR)
-- /tmp/pip-install-ji4xzb8c/xgboost_5bc73eb7ae8544b1bbb78e957c8e1faa/cpp_src/dmlc-core/cmake/build_config.h.in -> include/dmlc/build_config.h
-- Configuring done (0.2s)
-- Generating done (0.0s)
-- Build files have been written to: /tmp/tmpjce9lps0/libbuild
[ 1%] Building CXX object dmlc-core/CMakeFiles/dmlc.dir/src/config.cc.o
[ 2%] Building CXX object dmlc-core/CMakeFiles/dmlc.dir/src/io.cc.o
[ 3%] Building CXX object dmlc-core/CMakeFiles/dmlc.dir/src/data.cc.o
[ 4%] Building CXX object dmlc-core/CMakeFiles/dmlc.dir/src/io/recordio_split.cc.o
[ 5%] Building CXX object dmlc-core/CMakeFiles/dmlc.dir/src/recordio.cc.o
[ 6%] Building CXX object dmlc-core/CMakeFiles/dmlc.dir/src/io/indexed_recordio_split.cc.o
[ 7%] Building CXX object dmlc-core/CMakeFiles/dmlc.dir/src/io/line_split.cc.o
[ 8%] Building CXX object dmlc-core/CMakeFiles/dmlc.dir/src/io/input_split_base.cc.o
[ 9%] Building CXX object dmlc-core/CMakeFiles/dmlc.dir/src/io/filesys.cc.o
[ 10%] Building CXX object dmlc-core/CMakeFiles/dmlc.dir/src/io/local_filesys.cc.o
[ 11%] Linking CXX static library libdmlc.a
[ 11%] Built target dmlc
[ 12%] Building CXX object src/CMakeFiles/objxgboost.dir/c_api/c_api.cc.o
[ 13%] Building CXX object src/CMakeFiles/objxgboost.dir/common/column_matrix.cc.o
[ 14%] Building CXX object src/CMakeFiles/objxgboost.dir/c_api/c_api_error.cc.o
[ 15%] Building CXX object src/CMakeFiles/objxgboost.dir/collective/socket.cc.o
[ 16%] Building CXX object src/CMakeFiles/objxgboost.dir/collective/in_memory_communicator.cc.o
[ 17%] Building CXX object src/CMakeFiles/objxgboost.dir/collective/communicator.cc.o
[ 18%] Building CXX object src/CMakeFiles/objxgboost.dir/collective/in_memory_handler.cc.o
[ 19%] Building CXX object src/CMakeFiles/objxgboost.dir/common/charconv.cc.o
[ 20%] Building CXX object src/CMakeFiles/objxgboost.dir/common/common.cc.o
[ 21%] Building CXX object src/CMakeFiles/objxgboost.dir/common/error_msg.cc.o
[ 22%] Building CXX object src/CMakeFiles/objxgboost.dir/common/hist_util.cc.o
[ 23%] Building CXX object src/CMakeFiles/objxgboost.dir/common/host_device_vector.cc.o
[ 24%] Building CXX object src/CMakeFiles/objxgboost.dir/common/io.cc.o
[ 25%] Building CXX object src/CMakeFiles/objxgboost.dir/common/json.cc.o
[ 26%] Building CXX object src/CMakeFiles/objxgboost.dir/common/numeric.cc.o
[ 27%] Building CXX object src/CMakeFiles/objxgboost.dir/common/pseudo_huber.cc.o
[ 28%] Building CXX object src/CMakeFiles/objxgboost.dir/common/quantile.cc.o
/tmp/pip-install-ji4xzb8c/xgboost_5bc73eb7ae8544b1bbb78e957c8e1faa/cpp_src/src/common/io.cc: In function 'std::unique_ptr<xgboost::common::MMAPFile> xgboost::common::Open(std::string, std::size_t, std::size_t)':
/tmp/pip-install-ji4xzb8c/xgboost_5bc73eb7ae8544b1bbb78e957c8e1faa/cpp_src/src/common/io.cc:260:38: error: 'mmap64' was not declared in this scope; did you mean 'mmap'?
260 | ptr = reinterpret_cast<std::byte*>(mmap64(nullptr, view_size, prot, MAP_PRIVATE, fd, view_start));
| ^~~~~~
| mmap
make[2]: *** [src/CMakeFiles/objxgboost.dir/build.make:244: src/CMakeFiles/objxgboost.dir/common/io.cc.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/Makefile2:264: src/CMakeFiles/objxgboost.dir/all] Error 2
make: *** [Makefile:156: all] Error 2
Traceback (most recent call last):
File "/tmp/pip-install-ji4xzb8c/xgboost_5bc73eb7ae8544b1bbb78e957c8e1faa/packager/nativelib.py", line 102, in build_libxgboost
_build(generator=generator)
File "/tmp/pip-install-ji4xzb8c/xgboost_5bc73eb7ae8544b1bbb78e957c8e1faa/packager/nativelib.py", line 68, in _build
subprocess.check_call([build_tool, f"-j{nproc}"], cwd=build_dir)
File "/usr/lib/python3.11/subprocess.py", line 413, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['make', '-j8']' returned non-zero exit status 2.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
main()
File "/usr/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 152, in prepare_metadata_for_build_wheel
whl_basename = backend.build_wheel(metadata_directory, config_settings)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/pip-install-ji4xzb8c/xgboost_5bc73eb7ae8544b1bbb78e957c8e1faa/packager/pep517.py", line 79, in build_wheel
libxgboost = locate_or_build_libxgboost(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/pip-install-ji4xzb8c/xgboost_5bc73eb7ae8544b1bbb78e957c8e1faa/packager/nativelib.py", line 170, in locate_or_build_libxgboost
return build_libxgboost(cpp_src_dir, build_dir=build_dir, build_config=build_config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/pip-install-ji4xzb8c/xgboost_5bc73eb7ae8544b1bbb78e957c8e1faa/packager/nativelib.py", line 106, in build_libxgboost
_build(generator=generator)
File "/tmp/pip-install-ji4xzb8c/xgboost_5bc73eb7ae8544b1bbb78e957c8e1faa/packager/nativelib.py", line 68, in _build
subprocess.check_call([build_tool, f"-j{nproc}"], cwd=build_dir)
File "/usr/lib/python3.11/subprocess.py", line 413, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['make', '-j8']' returned non-zero exit status 2.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
[15:29:18] FATAL: Failed installing package xgboost
s6-rc: warning: unable to start service init-appdaemon: command exited 1
/run/s6/basedir/scripts/rc.init: warning: s6-rc failed to properly bring all the services up! Check your logs (in /run/uncaught-logs/current if you have in-container logging) for more information.
/run/s6/basedir/scripts/rc.init: fatal: stopping the container.
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service base-addon-log-level: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service base-addon-log-level successfully stopped
s6-rc: info: service base-addon-banner: stopping
s6-rc: info: service base-addon-banner successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped
Even though it’s apparently simple, I’ve been stuck on this for a few days and any help would be greatly appreciated.