Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LightGBM install fails on mac #114

Closed
ejm714 opened this issue Oct 10, 2023 · 5 comments · Fixed by #134
Closed

LightGBM install fails on mac #114

ejm714 opened this issue Oct 10, 2023 · 5 comments · Fixed by #134
Assignees
Labels
bug Something isn't working

Comments

@ejm714
Copy link
Collaborator

ejm714 commented Oct 10, 2023

To reproduce

❯ pip install cyfi
❯ cyfi predict --help
Traceback (most recent call last):
  File "/Users/emily/opt/anaconda3/envs/cyfi/bin/cyfi", line 5, in <module>
    from cyfi.cli import app
  File "/Users/emily/opt/anaconda3/envs/cyfi/lib/python3.10/site-packages/cyfi/cli.py", line 12, in <module>
    from cyfi.pipeline import CyFiPipeline
  File "/Users/emily/opt/anaconda3/envs/cyfi/lib/python3.10/site-packages/cyfi/pipeline.py", line 7, in <module>
    import lightgbm as lgb
  File "/Users/emily/opt/anaconda3/envs/cyfi/lib/python3.10/site-packages/lightgbm/__init__.py", line 8, in <module>
    from .basic import Booster, Dataset, Sequence, register_logger
  File "/Users/emily/opt/anaconda3/envs/cyfi/lib/python3.10/site-packages/lightgbm/basic.py", line 226, in <module>
    _LIB = _load_lib()
  File "/Users/emily/opt/anaconda3/envs/cyfi/lib/python3.10/site-packages/lightgbm/basic.py", line 211, in _load_lib
    lib = ctypes.cdll.LoadLibrary(lib_path[0])
  File "/Users/emily/opt/anaconda3/envs/cyfi/lib/python3.10/ctypes/__init__.py", line 452, in LoadLibrary
    return self._dlltype(name)
  File "/Users/emily/opt/anaconda3/envs/cyfi/lib/python3.10/ctypes/__init__.py", line 374, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: dlopen(/Users/emily/opt/anaconda3/envs/cyfi/lib/python3.10/site-packages/lightgbm/lib/lib_lightgbm.so, 0x0006): Library not loaded: /usr/local/opt/libomp/lib/libomp.dylib
  Referenced from: /Users/emily/opt/anaconda3/envs/cyfi/lib/python3.10/site-packages/lightgbm/lib/lib_lightgbm.so
  Reason: tried: '/usr/local/opt/libomp/lib/libomp.dylib' (no such file), '/usr/local/lib/libomp.dylib' (no such file), '/usr/lib/libomp.dylib' (no such file)
@ejm714 ejm714 added the bug Something isn't working label Oct 10, 2023
@jayqi
Copy link
Member

jayqi commented Nov 4, 2023

@ejm714 this seems to suggest you're missing a system library libomp. Have you tried brew install libomp?

https://formulae.brew.sh/formula/libomp

@jayqi
Copy link
Member

jayqi commented Nov 4, 2023

It's interesting actually that you are able to install lightgbm but then it errors at runtime. There are lots of other reports about errors at installation time related to libomp with compiling lightgbm.

microsoft/LightGBM#5700

@ejm714
Copy link
Collaborator Author

ejm714 commented Nov 13, 2023

Have you tried brew install libomp?

Yes and I get the same error. I think the best option for supporting Apple silicon will be with conda-forge.

@jayqi
Copy link
Member

jayqi commented Jan 2, 2024

For future reference, this SO post has a lot of answers that do a good job explaining the basic mechanics of the underlying problem: https://stackoverflow.com/questions/61971851/getting-this-simple-problem-while-importing-xgboost-on-jupyter-notebook


In any case, I got repro-zipfile on conda-forge so that shouldn't be a blocker for a cyfi feedstock anymore.

@ejm714 ejm714 self-assigned this Jan 5, 2024
@ejm714
Copy link
Collaborator Author

ejm714 commented Jan 5, 2024

conda-forge PR opened here: conda-forge/staged-recipes#24944

Once this is merged, we'll need to update the cyfi docs for mac installation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants