ubuntu pip安装xgboost的CMake 3.13 or higher is required. You are running version 3.10.2

网友投稿 449 2022-08-26

ubuntu pip安装xgboost的CMake 3.13 or higher is required. You are running version 3.10.2

今天在装xgboost的时候出现了下面的错误:

INFO:XGBoost build_ext:Building from source. /tmp/pip-install-elc4qdig/lib/libxgboost.so INFO:XGBoost build_ext:Run CMake command: ['cmake', 'xgboost', '-GUnix Makefiles', '-DUSE_OPENMP=1', '-DUSE_CUDA=0', '-DUSE_NCCL=0', '-DBUILD_WITH_SHARED_NCCL=0', '-DHIDE_CXX_SYMBOLS=1', '-DUSE_HDFS=0', '-DUSE_AZURE=0', '-DUSE_S3=0', '-DPLUGIN_LZ4=0', '-DPLUGIN_DENSE_PARSER=0'] CMake Error at CMakeLists.txt:1 (cmake_minimum_required): CMake 3.13 or higher is required. You are running version 3.10.2 -- Configuring incomplete, errors occurred! WARNING:XGBoost build_ext:Disabling OpenMP support. INFO:XGBoost build_ext:Run CMake command: ['cmake', 'xgboost', '-GUnix Makefiles', '-DUSE_OPENMP=1', '-DUSE_CUDA=0', '-DUSE_NCCL=0', '-DBUILD_WITH_SHARED_NCCL=0', '-DHIDE_CXX_SYMBOLS=1', '-DUSE_HDFS=0', '-DUSE_AZURE=0', '-DUSE_S3=0', '-DPLUGIN_LZ4=0', '-DPLUGIN_DENSE_PARSER=0'] CMake Error at CMakeLists.txt:1 (cmake_minimum_required): CMake 3.13 or higher is required. You are running version 3.10.2 -- Configuring incomplete, errors occurred! Traceback (most recent call last): File "/tmp/pip-install-elc4qdig/xgboost/setup.py", line 160, in build_cmake_extension self.build(src_dir, build_dir, gen, build_tool, use_omp=1) File "/tmp/pip-install-elc4qdig/xgboost/setup.py", line 110, in build subprocess.check_call(cmake_cmd, cwd=build_dir) File "/home/wugaosheng/anaconda3/lib/python3.7/subprocess.py", line 341, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['cmake', 'xgboost', '-GUnix Makefiles', '-DUSE_OPENMP=1', '-DUSE_CUDA=0', '-DUSE_NCCL=0', '-DBUILD_WITH_SHARED_NCCL=0', '-DHIDE_CXX_SYMBOLS=1', '-DUSE_HDFS=0', '-DUSE_AZURE=0', '-DUSE_S3=0', '-DPLUGIN_LZ4=0', '-DPLUGIN_DENSE_PARSER=0']' returned non-zero exit status 1. During handling of the above exception, another exception occurred: Traceback (most recent call last): File "", line 1, in File "/tmp/pip-install-elc4qdig/xgboost/setup.py", line 317, in url=' File "/home/wugaosheng/anaconda3/lib/python3.7/site-packages/setuptools/__init__.py", line 144, in setup return distutils.core.setup(**attrs) File "/home/wugaosheng/anaconda3/lib/python3.7/distutils/core.py", line 148, in setup dist.run_commands() File "/home/wugaosheng/anaconda3/lib/python3.7/distutils/dist.py", line 966, in run_commands self.run_command(cmd) File "/home/wugaosheng/anaconda3/lib/python3.7/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/tmp/pip-install-elc4qdig/xgboost/setup.py", line 257, in run super().run() File "/home/wugaosheng/anaconda3/lib/python3.7/site-packages/setuptools/command/install.py", line 61, in run return orig.install.run(self) File "/home/wugaosheng/anaconda3/lib/python3.7/distutils/command/install.py", line 545, in run self.run_command('build') File "/home/wugaosheng/anaconda3/lib/python3.7/distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/home/wugaosheng/anaconda3/lib/python3.7/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/home/wugaosheng/anaconda3/lib/python3.7/distutils/command/build.py", line 135, in run self.run_command(cmd_name) File "/home/wugaosheng/anaconda3/lib/python3.7/distutils/cmd.py", line 313, in run_command self.distribution.run_command(command) File "/home/wugaosheng/anaconda3/lib/python3.7/distutils/dist.py", line 985, in run_command cmd_obj.run() File "/home/wugaosheng/anaconda3/lib/python3.7/site-packages/setuptools/command/build_ext.py", line 87, in run _build_ext.run(self) File "/home/wugaosheng/anaconda3/lib/python3.7/site-packages/Cython/Distutils/old_build_ext.py", line 186, in run _build_ext.build_ext.run(self) File "/home/wugaosheng/anaconda3/lib/python3.7/distutils/command/build_ext.py", line 339, in run self.build_extensions() File "/home/wugaosheng/anaconda3/lib/python3.7/site-packages/Cython/Distutils/old_build_ext.py", line 194, in build_extensions self.build_extension(ext) File "/tmp/pip-install-elc4qdig/xgboost/setup.py", line 168, in build_extension self.build_cmake_extension() File "/tmp/pip-install-elc4qdig/xgboost/setup.py", line 163, in build_cmake_extension self.build(src_dir, build_dir, gen, build_tool, use_omp=0) File "/tmp/pip-install-elc4qdig/xgboost/setup.py", line 110, in build subprocess.check_call(cmake_cmd, cwd=build_dir) File "/home/wugaosheng/anaconda3/lib/python3.7/subprocess.py", line 341, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['cmake', 'xgboost', '-GUnix Makefiles', '-DUSE_OPENMP=1', '-DUSE_CUDA=0', '-DUSE_NCCL=0', '-DBUILD_WITH_SHARED_NCCL=0', '-DHIDE_CXX_SYMBOLS=1', '-DUSE_HDFS=0', '-DUSE_AZURE=0', '-DUSE_S3=0', '-DPLUGIN_LZ4=0', '-DPLUGIN_DENSE_PARSER=0']' returned non-zero exit status 1. ----------------------------------------Command "/home/wugaosheng/anaconda3/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-elc4qdig/xgboost/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-v6ltzbvr/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-elc4qdig/xgboost/

解决方法

sudo apt remove --purge cmakehash -rsudo snap install cmake --classiccmake --versionpip install xgboost

更新一下cmake就行了哈。

我的日志输出为:

wugaosheng@s206:~/tianchi_job_match/src$ cmake --versioncmake version 3.17.3CMake suite maintained and supported by Kitware (kitware.com/cmake).wugaosheng@s206:~/tianchi_job_match/src$ pip install xgboostLooking in indexes: xgboost Downloading (731kB) 100% |████████████████████████████████| 737kB 2.3MB/sRequirement already satisfied: numpy in /home/wugaosheng/anaconda3/lib/python3.7/site-packages (from xgboost) (1.15.4)Requirement already satisfied: scipy in /home/wugaosheng/anaconda3/lib/python3.7/site-packages (from xgboost) (1.1.0)Building wheels for collected packages: xgboost Running setup.py bdist_wheel for xgboost ... done Stored in directory: /home/wugaosheng/.cache/pip/wheels/e8/28/d4/db7f1dda731e5e14f4349e2c9dcd426a1b83720adae96c3afbSuccessfully built xgboostInstalling collected packages: xgboostSuccessfully installed xgboost-1.1.1

参考文献

[1]. Installing the latest CMake on Ubuntu 18.04. https://graspingtech.com/upgrade-cmake/#:~:text=The%20version%20of%20CMake%20installed,2.

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:营销的目的,在于让推销成为多余!(论述营销的目的就是要使推销成为多余的)
下一篇:python AttributeError: ‘SMOTE‘ object has no attribute ‘_validate_data‘
相关文章

 发表评论

暂时没有评论,来抢沙发吧~