提问人:Atrox 提问时间:11/2/2023 更新时间:11/3/2023 访问量:121
Apple silicon m2 错误:无法为 lightgbm 构建轮子,这是安装基于 pyproject.toml 的项目所必需的
Apple silicon m2 ERROR: Could not build wheels for lightgbm, which is required to install pyproject.toml-based projects
问:
我在 Apple Silicon 上安装 lighgbm 时遇到了问题,完整的安装过程如下:
python3 -m pip install lightgbm
Defaulting to user installation because normal site-packages is not writeable
Collecting lightgbm
Using cached lightgbm-4.1.0.tar.gz (1.7 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Installing backend dependencies ... done
Preparing metadata (pyproject.toml) ... done
Requirement already satisfied: numpy in ./Library/Python/3.11/lib/python/site-packages (from lightgbm) (1.23.5)
Requirement already satisfied: scipy in ./Library/Python/3.11/lib/python/site-packages (from lightgbm) (1.10.1)
Building wheels for collected packages: lightgbm
Building wheel for lightgbm (pyproject.toml) ... error
error: subprocess-exited-with-error
× Building wheel for lightgbm (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [45 lines of output]
2023-11-02 14:58:09,352 - scikit_build_core - INFO - CMake version: 3.27.7
*** scikit-build-core 0.6.0 using CMake 3.27.7 (wheel)
2023-11-02 14:58:09,356 - scikit_build_core - INFO - Build directory: /private/var/folders/7t/ys9t4mvn1fx74wckbywxd2sw0000gp/T/tmptyogi8su/build
*** Configuring CMake...
2023-11-02 14:58:09,372 - scikit_build_core - INFO - Ninja version: 1.11.1
2023-11-02 14:58:09,372 - scikit_build_core - WARNING - libdir/ldlibrary: /Library/Frameworks/Python.framework/Versions/3.11/lib/Python.framework/Versions/3.11/Python is not a real file!
loading initial cache file /var/folders/7t/ys9t4mvn1fx74wckbywxd2sw0000gp/T/tmptyogi8su/build/CMakeInit.txt
CMake Deprecation Warning at CMakeLists.txt:35 (cmake_minimum_required):
Compatibility with CMake < 3.5 will be removed from a future version of
CMake.
Update the VERSION argument <min> value or use a ...<max> suffix to tell
CMake that the project does not need compatibility with older versions.
-- The C compiler identification is AppleClang 15.0.0.15000040
-- The CXX compiler identification is AppleClang 15.0.0.15000040
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Could NOT find OpenMP_C (missing: OpenMP_C_FLAGS OpenMP_C_LIB_NAMES)
-- Could NOT find OpenMP_CXX (missing: OpenMP_CXX_FLAGS OpenMP_CXX_LIB_NAMES)
-- Could NOT find OpenMP (missing: OpenMP_C_FOUND OpenMP_CXX_FOUND)
-- Found OpenMP_C: -Xpreprocessor -fopenmp -I/include
-- Found OpenMP_CXX: -Xpreprocessor -fopenmp -I/include
-- Found OpenMP: TRUE
-- Performing Test MM_PREFETCH
-- Performing Test MM_PREFETCH - Failed
-- Performing Test MM_MALLOC
-- Performing Test MM_MALLOC - Success
-- Using _mm_malloc
-- Configuring done (9.3s)
-- Generating done (0.0s)
-- Build files have been written to: /var/folders/7t/ys9t4mvn1fx74wckbywxd2sw0000gp/T/tmptyogi8su/build
*** Building project with Ninja...
ninja: error: '/lib/libomp.dylib', needed by '/private/var/folders/7t/ys9t4mvn1fx74wckbywxd2sw0000gp/T/pip-install-zb1bf93d/lightgbm_d399d75f04b14379ba9d10c8bffd1542/lib_lightgbm.so', missing and no known rule to make it
*** CMake build failed
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for lightgbm
Failed to build lightgbm
ERROR: Could not build wheels for lightgbm, which is required to install pyproject.toml-based projects
据我了解,在安装 lightgbm 之前我需要有 libomp。但是,我已经安装了它,但我仍然继续遇到同样的问题。它是否与目录与它应该在的位置不同有关?如何检查问题所在?
brew install libomp
==> Downloading https://formulae.brew.sh/api/formula.jws.json
#=#=- # # #=O#- # # -#O=- # # # -=O#- # # # -=O=-# # # # -=O=- # # # # -=O=- # # # # ######################################################################################################################################################################################################################################################### 100.0%
==> Downloading https://formulae.brew.sh/api/cask.jws.json
######################################################################################################################################################################################################################################################### 100.0%
Warning: libomp 17.0.4 is already installed and up-to-date.
To reinstall 17.0.4, run:
brew reinstall libomp
感谢您抽出宝贵时间接受采访。
答:
0赞
Atrox
11/3/2023
#1
我找到了解决方案,基本上我删除了已安装的 python 并使用自制软件安装了 python,然后一切正常。
评论