2

我逐步遵循官方指南并获得最后一个命令(我也从https://github.com/Microsoft/LightGBM/blob/master/docs/Installation-Guide.rst#linux构建 GPU 版本):

pip3 install lightgbm --install=--gpu

当我执行这个命令时,得到了这个:

/usr/lib/python3/dist-packages/pip/commands/install.py:212: UserWarning: Disabling all use of wheels due to the use of --build-options / --global-options / --install-options.
  cmdoptions.check_install_build_global(options)
Collecting lightgbm
  Using cached https://files.pythonhosted.org/packages/53/96/a412bdfe80bb7cadfafea5c980385538bc2a91ff0086ff6684a51275992e/lightgbm-2.1.2.tar.gz
Collecting numpy (from lightgbm)
  Using cached https://files.pythonhosted.org/packages/d5/6e/f00492653d0fdf6497a181a1c1d46bbea5a2383e7faf4c8ca6d6f3d2581d/numpy-1.14.5.zip
Collecting scipy (from lightgbm)
  Using cached https://files.pythonhosted.org/packages/07/76/7e844757b9f3bf5ab9f951ccd3e4a8eed91ab8720b0aac8c2adcc2fdae9f/scipy-1.1.0.tar.gz
Collecting scikit-learn (from lightgbm)
  Using cached https://files.pythonhosted.org/packages/f5/2c/5edf2488897cad4fb8c4ace86369833552615bf264460ae4ef6e1f258982/scikit-learn-0.19.1.tar.gz
Skipping bdist_wheel for lightgbm, due to binaries being disabled for it.
Skipping bdist_wheel for numpy, due to binaries being disabled for it.
Skipping bdist_wheel for scipy, due to binaries being disabled for it.
Skipping bdist_wheel for scikit-learn, due to binaries being disabled for it.
Installing collected packages: numpy, scipy, scikit-learn, lightgbm
  Running setup.py install for numpy ... error
    Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-af4e39bs/numpy/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-ti5s7akt-record/install-record.txt --single-version-externally-managed --compile --gpu --user --prefix=:
    Running from numpy source directory.

    Note: if you need reliable uninstall behavior, then install
    with pip instead of using `setup.py install`:

      - `pip install .`       (from a git repo or downloaded source
                               release)
      - `pip install numpy`   (last NumPy release on PyPi)


    usage: -c [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
       or: -c --help [cmd1 cmd2 ...]
       or: -c --help-commands
       or: -c cmd --help

    error: option --gpu not recognized

    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-af4e39bs/numpy/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-ti5s7akt-record/install-record.txt --single-version-externally-managed --compile --gpu --user --prefix=" failed with error code 1 in /tmp/pip-build-af4e39bs/numpy/

我尝试安装 setuptools、numpy、scipy。这没有帮助

4

1 回答 1

1

添加sudo对我有用:

sudo pip3 install lightgbm --install-option=--gpu --install-option="--opencl-include-dir=/usr/local/cuda/include/" --install-option="--opencl-library=/usr/local/cuda/lib64/libOpenCL.so"

我怀疑跑步setup.py install for numpy需要sudo权利,即使pip3不需要

于 2018-12-19T15:16:13.273 回答