我正在从事这个 ml 项目,我需要使用 pip 安装 catboost 和 xgboost。xgboost 已成功安装,但 catboost 一直出现相同的错误:
(venv) D:\ML bootcamp\mlproject>pip install catboost
Collecting catboost
Using cached catboost-1.2.7.tar.gz (71.5 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... error
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [24 lines of output]
Traceback (most recent call last):
File "D:\ML bootcamp\mlproject\venv\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 389, in <module>
main()
~~~~^^
File "D:\ML bootcamp\mlproject\venv\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 373, in main
json_out["return_val"] = hook(**hook_input["kwargs"])
~~~~^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\ML bootcamp\mlproject\venv\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 143, in get_requires_for_build_wheel
return hook(config_settings)
File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-xzdiplgy\overlay\Lib\site-packages\setuptools\build_meta.py", line 334, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=[])
~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-xzdiplgy\overlay\Lib\site-packages\setuptools\build_meta.py", line 304, in _get_build_requires
self.run_setup()
~~~~~~~~~~~~~~^^
File "C:\Users\Administrator\AppData\Local\Temp\pip-build-env-xzdiplgy\overlay\Lib\site-packages\setuptools\build_meta.py", line 522, in run_setup
super().run_setup(setup_script=setup_script)
~~~~^^^^^^^^^^^^^^^^
File "<string>", line 733, in <module>
File "<string>", line 205, in get_catboost_version
KeyError: 'VERSION'
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
我已经尽我所能了,但我不知道还能做什么来解决这个问题。如果有人知道解决办法,请告诉我。
根据
catboost
安装文档来源:https ://catboost.ai/docs/en/concepts/python-installation
他们的 github repo 上也有一个未解决的问题:
https://github.com/catboost/catboost/issues/2748
一个可能的解决方案是使用当前支持的 Python 版本
catboost
。例如3.12.x