작성
·
161
0
맥북m2 사용중입니다. venv환경에서 pip install lightgbm==3.3.2를 했지만 아래와 같은 오류가 나옵니다.
3.3.2없이 가장 최신 버젼이 4.5.0은 아주 쉽게 잘 설치가 됩니다. 혹시 강의를 수강할 때 3.3.2가 꼭필요한가요? conda 환경으로 설치를 진행해도 3.3.2는 설치가 안되더라구요ㅠㅠ 구글링을 해서 하라는 것은 다 했는데 해결이 안나와서 문의 드립니다..
==========================================
pip install lightgbm==3.3.2
Collecting lightgbm==3.3.2
Using cached lightgbm-3.3.2.tar.gz (1.5 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Collecting wheel (from lightgbm==3.3.2)
Using cached wheel-0.44.0-py3-none-any.whl.metadata (2.3 kB)
Requirement already satisfied: numpy in ./study/lib/python3.9/site-packages (from lightgbm==3.3.2) (1.24.3)
Requirement already satisfied: scipy in ./study/lib/python3.9/site-packages (from lightgbm==3.3.2) (1.13.1)
Requirement already satisfied: scikit-learn!=0.22.0 in ./study/lib/python3.9/site-packages (from lightgbm==3.3.2) (1.0.2)
Requirement already satisfied: joblib>=0.11 in ./study/lib/python3.9/site-packages (from scikit-learn!=0.22.0->lightgbm==3.3.2) (1.4.2)
Requirement already satisfied: threadpoolctl>=2.0.0 in ./study/lib/python3.9/site-packages (from scikit-learn!=0.22.0->lightgbm==3.3.2) (3.5.0)
Using cached wheel-0.44.0-py3-none-any.whl (67 kB)
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
╰─> [83 lines of output]
INFO:root:running bdist_wheel
INFO:root:running build
INFO:root:running build_py
INFO:root:creating build/lib/lightgbm
INFO:root:copying lightgbm/callback.py -> build/lib/lightgbm
INFO:root:copying lightgbm/compat.py -> build/lib/lightgbm
INFO:root:copying lightgbm/plotting.py -> build/lib/lightgbm
INFO:root:copying lightgbm/__init__.py -> build/lib/lightgbm
INFO:root:copying lightgbm/engine.py -> build/lib/lightgbm
INFO:root:copying lightgbm/dask.py -> build/lib/lightgbm
INFO:root:copying lightgbm/basic.py -> build/lib/lightgbm
INFO:root:copying lightgbm/libpath.py -> build/lib/lightgbm
INFO:root:copying lightgbm/sklearn.py -> build/lib/lightgbm
INFO:root:running egg_info
INFO:root:writing lightgbm.egg-info/PKG-INFO
INFO:root:writing dependency_links to lightgbm.egg-info/dependency_links.txt
INFO:root:writing requirements to lightgbm.egg-info/requires.txt
INFO:root:writing top-level names to lightgbm.egg-info/top_level.txt
INFO:root:reading manifest file 'lightgbm.egg-info/SOURCES.txt'
INFO:root:reading manifest template 'MANIFEST.in'
WARNING:root:no previously-included directories found matching 'build'
WARNING:root:warning: no files found matching '*.so' under directory 'lightgbm'
WARNING:root:warning: no files found matching '*.so' under directory 'compile'
WARNING:root:warning: no files found matching '*.dll' under directory 'compile/Release'
WARNING:root:warning: no files found matching '*.dll' under directory 'compile/windows/x64/DLL'
WARNING:root:warning: no previously-included files matching '*.py[co]' found anywhere in distribution
WARNING:root:warning: no previously-included files found matching 'compile/external_libs/compute/.git'
INFO:root:adding license file 'LICENSE'
INFO:root:writing manifest file 'lightgbm.egg-info/SOURCES.txt'
INFO:root:copying lightgbm/VERSION.txt -> build/lib/lightgbm
INFO:wheel:installing to build/bdist.macosx-10.9-universal2/wheel
INFO:root:running install
INFO:LightGBM:Starting to compile the library.
INFO:LightGBM:Starting to compile with CMake.
Traceback (most recent call last):
File "<string>", line 95, in silent_call
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 373, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '/private/var/folders/q_/cgds3zcd57z43n2hc_mfsklr0000gn/T/pip-install-_35mq2ue/lightgbm_4b238c34e6dd4d93979880ebb06cf41d/compile']' returned non-zero exit status 1.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/ike/py3-9/study/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
main()
File "/Users/ike/py3-9/study/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/Users/ike/py3-9/study/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 251, in build_wheel
return buildbackend().build_wheel(wheel_directory, config_settings,
File "/private/var/folders/q_/cgds3zcd57z43n2hc_mfsklr0000gn/T/pip-build-env-nmcdsyxm/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 421, in build_wheel
return self._build_with_temp_dir(
File "/private/var/folders/q_/cgds3zcd57z43n2hc_mfsklr0000gn/T/pip-build-env-nmcdsyxm/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 403, in buildwith_temp_dir
self.run_setup()
File "/private/var/folders/q_/cgds3zcd57z43n2hc_mfsklr0000gn/T/pip-build-env-nmcdsyxm/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 503, in run_setup
super().run_setup(setup_script=setup_script)
File "/private/var/folders/q_/cgds3zcd57z43n2hc_mfsklr0000gn/T/pip-build-env-nmcdsyxm/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 318, in run_setup
exec(code, locals())
File "<string>", line 334, in <module>
File "/private/var/folders/q_/cgds3zcd57z43n2hc_mfsklr0000gn/T/pip-build-env-nmcdsyxm/overlay/lib/python3.9/site-packages/setuptools/__init__.py", line 117, in setup
return distutils.core.setup(**attrs)
File "/private/var/folders/q_/cgds3zcd57z43n2hc_mfsklr0000gn/T/pip-build-env-nmcdsyxm/overlay/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 183, in setup
return run_commands(dist)
File "/private/var/folders/q_/cgds3zcd57z43n2hc_mfsklr0000gn/T/pip-build-env-nmcdsyxm/overlay/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 199, in run_commands
dist.run_commands()
File "/private/var/folders/q_/cgds3zcd57z43n2hc_mfsklr0000gn/T/pip-build-env-nmcdsyxm/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 954, in run_commands
self.run_command(cmd)
File "/private/var/folders/q_/cgds3zcd57z43n2hc_mfsklr0000gn/T/pip-build-env-nmcdsyxm/overlay/lib/python3.9/site-packages/setuptools/dist.py", line 950, in run_command
super().run_command(command)
File "/private/var/folders/q_/cgds3zcd57z43n2hc_mfsklr0000gn/T/pip-build-env-nmcdsyxm/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 973, in run_command
cmd_obj.run()
File "/private/var/folders/q_/cgds3zcd57z43n2hc_mfsklr0000gn/T/pip-build-env-nmcdsyxm/overlay/lib/python3.9/site-packages/setuptools/_vendor/wheel/bdist_wheel.py", line 403, in run
self.run_command("install")
File "/private/var/folders/q_/cgds3zcd57z43n2hc_mfsklr0000gn/T/pip-build-env-nmcdsyxm/overlay/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 316, in run_command
self.distribution.run_command(command)
File "/private/var/folders/q_/cgds3zcd57z43n2hc_mfsklr0000gn/T/pip-build-env-nmcdsyxm/overlay/lib/python3.9/site-packages/setuptools/dist.py", line 950, in run_command
super().run_command(command)
File "/private/var/folders/q_/cgds3zcd57z43n2hc_mfsklr0000gn/T/pip-build-env-nmcdsyxm/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 973, in run_command
cmd_obj.run()
File "<string>", line 248, in run
File "<string>", line 198, in compile_cpp
File "<string>", line 99, in silent_call
Exception: Please install CMake and all required dependencies first
The full version of error log was saved into /Users/ike/LightGBM_compilation.log
[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: ERROR: Failed to build installable wheels for some pyproject.toml based projects (lightgbm)
==========================================
답변 2
0
안녕하세요, 인프런 AI 인턴입니다. wkk90님.
맥 환경에서 LightGBM 3.3.2 설치 시 발생하는 문제에 대해 여러 사용자가 유사한 문제를 제기한 적이 있습니다.
아래에 관련된 몇 가지 유사한 질문과 해결 방법을 안내 드립니다.
miniforge
가상 환경을 사용하셨고 pip install lightgbm
시도 시 에러가 발생했습니다. 강사님께서는 Anaconda
를 통해 설치를 하도록 권장하였습니다.안녕하세요. 선생님 xgboost lightgbm 패키지 설치 문의드립니다.
xgboost
와 lightgbm
설치 후 실행 시 오류가 발생한 경우입니다. 강사님께서는 anaconda
를 통해 설치할 것을 권장하였고, conda-forge
채널을 통해 설치 방법을 안내하였습니다.conda install -c conda-forge xgboost
brew install lightgbm
및 pip install lightgbm
시도 후에도 오류가 발생했습니다. 강사님께서는 conda
를 통해 설치하도록 권장하셨고, 사용자께서 conda
로 설치한 후 문제를 해결하셨습니다.conda install -c conda-forge lightgbm
이밖에, 사용자가 발생한 문제와 비슷한 상황에서 다음과 같은 추가 조치가 필요한 경우가 있습니다:
CMake 설치
brew install cmake
libomp 설치
libomp
를 설치해야 할 수도 있습니다.
brew install libomp
환경 변수 설정
libomp
설치 후 환경 변수를 설정합니다.
echo 'export PATH="/usr/local/opt/libomp/bin:$PATH"' >> ~/.zshrc
echo 'export LDFLAGS="-L/usr/local/opt/libomp/lib"' >> ~/.zshrc
echo 'export CPPFLAGS="-I/usr/local/opt/libomp/include"' >> ~/.zshrc
source ~/.zshrc
앞의 예들처럼 conda
를 통한 설치가 문제를 해결할 수 있는 경우가 많습니다. 하지만 경우에 따라 특정 버전을 설치하는데 어려움을 겪으실 수 있습니다. 따라서 최신 버전으로 설치 후 강의에 주어진 내용에 맞춰 진행하실 수 있습니다.
만약 최신 버전에서 문제가 발생하지 않는다면 그 버전을 사용하셔도 무방합니다.
저는 질문자님의 이해를 돕고자 지식공유자님의 기존 답변을 참고하여 유사한 답변 링크를 추천해드리고 있습니다.
현재 베타 기능으로 답변이 만족스럽지 않을 수 있는 점 양해 부탁드립니다. 🙏
추가적으로 궁금한 점이 있으시면, 이어서 질문해 주세요. 곧 지식공유자께서 답변해 주실 것입니다.
말씀하신 대로 cmake를 설치 후 다시 Lightgbm을 설치했지만, 아래와 같은 메세지가 나옵니다.. ㅠㅠ 뭔가 제 환경이 꼬인건가봐요...
pip install lightgbm==3.3.2
Collecting lightgbm==3.3.2
Using cached lightgbm-3.3.2.tar.gz (1.5 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Collecting wheel (from lightgbm==3.3.2)
Using cached wheel-0.44.0-py3-none-any.whl.metadata (2.3 kB)
Requirement already satisfied: numpy in ./venv/lib/python3.9/site-packages (from lightgbm==3.3.2) (1.23.5)
Requirement already satisfied: scipy in ./venv/lib/python3.9/site-packages (from lightgbm==3.3.2) (1.10.1)
Requirement already satisfied: scikit-learn!=0.22.0 in ./venv/lib/python3.9/site-packages (from lightgbm==3.3.2) (1.4.2)
Requirement already satisfied: joblib>=1.2.0 in ./venv/lib/python3.9/site-packages (from scikit-learn!=0.22.0->lightgbm==3.3.2) (1.3.2)
Requirement already satisfied: threadpoolctl>=2.0.0 in ./venv/lib/python3.9/site-packages (from scikit-learn!=0.22.0->lightgbm==3.3.2) (3.5.0)
Using cached wheel-0.44.0-py3-none-any.whl (67 kB)
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
╰─> [83 lines of output]
INFO:root:running bdist_wheel
INFO:root:running build
INFO:root:running build_py
INFO:root:creating build/lib/lightgbm
INFO:root:copying lightgbm/callback.py -> build/lib/lightgbm
INFO:root:copying lightgbm/compat.py -> build/lib/lightgbm
INFO:root:copying lightgbm/plotting.py -> build/lib/lightgbm
INFO:root:copying lightgbm/__init__.py -> build/lib/lightgbm
INFO:root:copying lightgbm/engine.py -> build/lib/lightgbm
INFO:root:copying lightgbm/dask.py -> build/lib/lightgbm
INFO:root:copying lightgbm/basic.py -> build/lib/lightgbm
INFO:root:copying lightgbm/libpath.py -> build/lib/lightgbm
INFO:root:copying lightgbm/sklearn.py -> build/lib/lightgbm
INFO:root:running egg_info
INFO:root:writing lightgbm.egg-info/PKG-INFO
INFO:root:writing dependency_links to lightgbm.egg-info/dependency_links.txt
INFO:root:writing requirements to lightgbm.egg-info/requires.txt
INFO:root:writing top-level names to lightgbm.egg-info/top_level.txt
INFO:root:reading manifest file 'lightgbm.egg-info/SOURCES.txt'
INFO:root:reading manifest template 'MANIFEST.in'
WARNING:root:no previously-included directories found matching 'build'
WARNING:root:warning: no files found matching '*.so' under directory 'lightgbm'
WARNING:root:warning: no files found matching '*.so' under directory 'compile'
WARNING:root:warning: no files found matching '*.dll' under directory 'compile/Release'
WARNING:root:warning: no files found matching '*.dll' under directory 'compile/windows/x64/DLL'
WARNING:root:warning: no previously-included files matching '*.py[co]' found anywhere in distribution
WARNING:root:warning: no previously-included files found matching 'compile/external_libs/compute/.git'
INFO:root:adding license file 'LICENSE'
INFO:root:writing manifest file 'lightgbm.egg-info/SOURCES.txt'
INFO:root:copying lightgbm/VERSION.txt -> build/lib/lightgbm
INFO:wheel:installing to build/bdist.macosx-10.9-universal2/wheel
INFO:root:running install
INFO:LightGBM:Starting to compile the library.
INFO:LightGBM:Starting to compile with CMake.
Traceback (most recent call last):
File "<string>", line 95, in silent_call
File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 373, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['cmake', '/private/var/folders/q_/cgds3zcd57z43n2hc_mfsklr0000gn/T/pip-install-2mzzacwn/lightgbm_c96e0a34421b43f09598d4de9f89d874/compile']' returned non-zero exit status 1.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/ike/py3-9/venv/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
main()
File "/Users/ike/py3-9/venv/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/Users/ike/py3-9/venv/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 251, in build_wheel
return buildbackend().build_wheel(wheel_directory, config_settings,
File "/private/var/folders/q_/cgds3zcd57z43n2hc_mfsklr0000gn/T/pip-build-env-ddryqc18/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 421, in build_wheel
return self._build_with_temp_dir(
File "/private/var/folders/q_/cgds3zcd57z43n2hc_mfsklr0000gn/T/pip-build-env-ddryqc18/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 403, in buildwith_temp_dir
self.run_setup()
File "/private/var/folders/q_/cgds3zcd57z43n2hc_mfsklr0000gn/T/pip-build-env-ddryqc18/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 503, in run_setup
super().run_setup(setup_script=setup_script)
File "/private/var/folders/q_/cgds3zcd57z43n2hc_mfsklr0000gn/T/pip-build-env-ddryqc18/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 318, in run_setup
exec(code, locals())
File "<string>", line 334, in <module>
File "/private/var/folders/q_/cgds3zcd57z43n2hc_mfsklr0000gn/T/pip-build-env-ddryqc18/overlay/lib/python3.9/site-packages/setuptools/__init__.py", line 117, in setup
return distutils.core.setup(**attrs)
File "/private/var/folders/q_/cgds3zcd57z43n2hc_mfsklr0000gn/T/pip-build-env-ddryqc18/overlay/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 183, in setup
return run_commands(dist)
File "/private/var/folders/q_/cgds3zcd57z43n2hc_mfsklr0000gn/T/pip-build-env-ddryqc18/overlay/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 199, in run_commands
dist.run_commands()
File "/private/var/folders/q_/cgds3zcd57z43n2hc_mfsklr0000gn/T/pip-build-env-ddryqc18/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 954, in run_commands
self.run_command(cmd)
File "/private/var/folders/q_/cgds3zcd57z43n2hc_mfsklr0000gn/T/pip-build-env-ddryqc18/overlay/lib/python3.9/site-packages/setuptools/dist.py", line 950, in run_command
super().run_command(command)
File "/private/var/folders/q_/cgds3zcd57z43n2hc_mfsklr0000gn/T/pip-build-env-ddryqc18/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 973, in run_command
cmd_obj.run()
File "/private/var/folders/q_/cgds3zcd57z43n2hc_mfsklr0000gn/T/pip-build-env-ddryqc18/overlay/lib/python3.9/site-packages/setuptools/_vendor/wheel/bdist_wheel.py", line 403, in run
self.run_command("install")
File "/private/var/folders/q_/cgds3zcd57z43n2hc_mfsklr0000gn/T/pip-build-env-ddryqc18/overlay/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 316, in run_command
self.distribution.run_command(command)
File "/private/var/folders/q_/cgds3zcd57z43n2hc_mfsklr0000gn/T/pip-build-env-ddryqc18/overlay/lib/python3.9/site-packages/setuptools/dist.py", line 950, in run_command
super().run_command(command)
File "/private/var/folders/q_/cgds3zcd57z43n2hc_mfsklr0000gn/T/pip-build-env-ddryqc18/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 973, in run_command
cmd_obj.run()
File "<string>", line 248, in run
File "<string>", line 198, in compile_cpp
File "<string>", line 99, in silent_call
Exception: Please install CMake and all required dependencies first
The full version of error log was saved into /Users/ike/LightGBM_compilation.log
[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: ERROR: Failed to build installable wheels for some pyproject.toml based projects (lightgbm)