在具有OpenMP依赖性的Mac上安装Lightgbm [英] Installing Lightgbm on Mac with OpenMP dependency

查看:209
本文介绍了在具有OpenMP依赖性的Mac上安装Lightgbm的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是python新手,想安装 lightgbm 在我的Macbook上.我做了一个pip install lightgbm,它说安装成功.但是,当我尝试将其导入到笔记本中时,出现以下错误消息:

I'm new to python and would like to install lightgbm on my macbook. I did a pip install lightgbm and it said installation successful. However when I try to import that into my notebook I get the following error message:

../anaconda/envs/python3/lib/python3.6/ctypes/__init__.py in __init__(self, name, mode, handle, use_errno, use_last_error)
342 
343         if handle is None:
--> 344             self._handle = _dlopen(self._name, mode)
345         else:
346             self._handle = handle

OSError: dlopen(../anaconda/envs/python3/lib/python3.6/site-packages/lightgbm/lib_lightgbm.so, 6): Library not loaded: /usr/local/opt/gcc/lib/gcc/7/libgomp.1.dylib
Referenced from: ../anaconda/envs/python3/lib/python3.6/site-packages/lightgbm/lib_lightgbm.so
Reason: image not found

lightgbm网站上的文档使用brew install...提供了不同的安装指南.我的问题是我是否必须进行Brew安装?如果是这种情况,为什么pip安装显示成功安装?

The documentation on lightgbm website gives a different installation guideline using brew install.... My question is whether I have to do a brew install? If that's the case why the pip installation shows successful installation then?

推荐答案

pip仅安装lightgbm python文件. 文档指出lightgbm依赖于OpenMP.因此,您也需要安装它.您面临的问题是因为python无法找到OpenMP随附的必需动态链接库".

pip would only install lightgbm python files. The documentation states that lightgbm depends on OpenMP. So you need to install that as well. The problem you are facing is because python cannot find the required "dynamic link library" that comes with OpenMP.

brew install open-mpi,它应该可以解决问题.

brew install open-mpi and it should fix the problem.

旁注:作为一项快速测试,我以与您相同的方式安装了lightgbm,并且遇到了相同的问题.但是我在/usr/local/opt/gcc/lib/gcc/6中找到了libgopm.1.dylib.将其符号链接到所需路径并不成功.

Sidenote: As a quick test, I installed lightgbm the same way you did, and faced the same problem. But I located the libgopm.1.dylib in /usr/local/opt/gcc/lib/gcc/6. Symlinking it to the required path didn't prove to be successful.

这篇关于在具有OpenMP依赖性的Mac上安装Lightgbm的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆