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

Other dependencies #1

Open
CraigMarkwardt opened this issue Jul 13, 2021 · 7 comments
Open

Other dependencies #1

CraigMarkwardt opened this issue Jul 13, 2021 · 7 comments

Comments

@CraigMarkwardt
Copy link

The code also appears to depend on "xgboost"

It also appears to depend on libomp in a non-trivial way. I think it has a hard-coded path to Homebrew's libomp path.

@CraigMarkwardt
Copy link
Author

Here is the runtime error. There are references to "brew install" and /usr/local/opt/libomp/lib/libomp.dylib, which is not where MacPorts installs its version of libomp.

[68]> python3.8
Python 3.8.11 (default, Jul  9 2021, 10:31:44)
[Clang 12.0.0 (clang-1200.0.32.29)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> modData = np.load('model.npz',allow_pickle=True)
>>> mod       = modData['mod'][()]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/numpy/lib/npyio.py", line 254, in __getitem__
    return format.read_array(bytes,
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/numpy/lib/format.py", line 748, in read_array
    array = pickle.load(fp, **pickle_kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/xgboost/__init__.py", line 9, in <module>
    from .core import DMatrix, DeviceQuantileDMatrix, Booster
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/xgboost/core.py", line 195, in <module>
    _LIB = _load_lib()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/xgboost/core.py", line 178, in _load_lib
    raise XGBoostError(
xgboost.core.XGBoostError: XGBoost Library (libxgboost.dylib) could not be loaded.
Likely causes:
  * OpenMP runtime is not installed (vcomp140.dll or libgomp-1.dll for Windows, libomp.dylib for Mac OSX, libgomp.so for Linux and other UNIX-like OSes). Mac OSX users: Run brew install libomp to install OpenMP runtime.
  * You are running 32-bit Python on a 64-bit OS
Error message(s): ['dlopen(/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/xgboost/lib/libxgboost.dylib, 6): Library not loaded: /usr/local/opt/libomp/lib/libomp.dylib\n  Referenced from: /opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/xgboost/lib/libxgboost.dylib\n  Reason: image not found']

@zoghbi-a
Copy link
Owner

Thanks Craig,
I see why it would complain about XGBoost. Does it solve it if XGBoost is installed?

@CraigMarkwardt
Copy link
Author

Not installing XGBoost causes a different, earlier error.

Installing XGBoost still leads to the above error.

@zoghbi-a
Copy link
Owner

I see.
The model may need to be saved and read using XGboost.
I will try to reproduce the error and work on it. Thanks.

@zoghbi-a
Copy link
Owner

I was able to reproduce the issue on my mac laptop. It was solved by installing py-xgboost (through pip or conda).

@CraigMarkwardt
Copy link
Author

Maybe not pip?

# pip-3.8 install py-xgboost
ERROR: Could not find a version that satisfies the requirement py-xgboost (from versions: none)
ERROR: No matching distribution found for py-xgboost

@zoghbi-a
Copy link
Owner

zoghbi-a commented Jul 14, 2021

It looks like it is a problem with xgboost on mac.
It is available only through conda.

The other solution is to install libomp with brew: "brew install libomp" and xgboost with pip. That also solved it for me.

Another option is to try building xgboost from source. https://xgboost.readthedocs.io/en/latest/build.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants