LightGBM GPU win10 pip安装

2024-06-02 05:00:09 发布

您现在位置:Python中文网/ 问答频道 /正文

我尝试按照指导原则基于https://github.com/microsoft/LightGBM/tree/master/python-package构建python包

我已经安装了vs2019、cmake 3.17.2和boost 1.73.0-msvc-14.2-64.exe

Python版本是3.6.8

pip install lightgbm --install-option=--gpu --install-option="--boost-dir=d:/boost_1_73_0" --install-option="--boost-librarydir=d:/boost_1_73_0/lib64-msvc-14.2"

它给出了以下错误

    ERROR: Command errored out with exit status 1:
     command: 'd:\python36\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\chest\\AppData\\Local\\Temp\\pip-install-wy_duymo\\lightgbm\\setup.py'"'"'; __file__='"'"'C:\\Users\\chest\\AppData\\Local\\Temp\\pip-install-wy_duymo\\lightgbm\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\chest\AppData\Local\Temp\pip-record-oyinzk76\install-record.txt' --single-version-externally-managed --compile --install-headers 'd:\python36\Include\lightgbm' --gpu --boost-dir=d:/boost_1_73_0 -boost-librarydir=d:/boost_1_73_0/lib64-msvc-14.2
         cwd: C:\Users\chest\AppData\Local\Temp\pip-install-wy_duymo\lightgbm\
    Complete output (6 lines):
    usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
       or: setup.py --help [cmd1 cmd2 ...]
       or: setup.py --help-commands
       or: setup.py cmd --help

    error: option -b not recognized

“--boost librarydir”修复后,出现新错误:

    ERROR: Command errored out with exit status 1:
     command: 'd:\python36\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\chest\\AppData\\Local\\Temp\\pip-install-rsk81qed\\lightgbm\\setup.py'"'"'; __file__='"'"'C:\\Users\\chest\\AppData\\Local\\Temp\\pip-install-rsk81qed\\lightgbm\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\chest\AppData\Local\Temp\pip-record-8v2a16nb\install-record.txt' --single-version-externally-managed --compile --install-headers 'd:\python36\Include\lightgbm' --gpu --boost-dir=d:/boost_1_73_0 --boost-librarydir=d:/boost_1_73_0/lib64-msvc-14.2
         cwd: C:\Users\chest\AppData\Local\Temp\pip-install-rsk81qed\lightgbm\
    Complete output (23 lines):
    running install
    INFO:LightGBM:Starting to compile the library.
    INFO:LightGBM:Starting to compile with Visual Studio 16 2019.
    INFO:LightGBM:Starting to compile with Visual Studio 15 2017.
    INFO:LightGBM:Starting to compile with Visual Studio 14 2015.
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\chest\AppData\Local\Temp\pip-install-rsk81qed\lightgbm\setup.py", line 345, in <module>
        'Topic :: Scientific/Engineering :: Artificial Intelligence'])
      File "d:\python36\lib\site-packages\setuptools\__init__.py", line 144, in setup
        return distutils.core.setup(**attrs)
      File "d:\python36\lib\distutils\core.py", line 148, in setup
        dist.run_commands()
      File "d:\python36\lib\distutils\dist.py", line 955, in run_commands
        self.run_command(cmd)
      File "d:\python36\lib\distutils\dist.py", line 974, in run_command
        cmd_obj.run()
      File "C:\Users\chest\AppData\Local\Temp\pip-install-rsk81qed\lightgbm\setup.py", line 272, in run
        nomp=self.nomp, bit32=self.bit32)
      File "C:\Users\chest\AppData\Local\Temp\pip-install-rsk81qed\lightgbm\setup.py", line 164, in compile_cpp
        LOG_NOTICE)))
    Exception: Please install Visual Studio or MS Build and all required dependencies first
    The full version of error log was saved into C:\Users\chest\LightGBM_compilation.log

Tags: installpippylocalsetuplineusersappdata