Skip to content

OpenMP lib dep causes test failure. #908

Description

@ras44

Describe the bug
Mentioned by @jakevdp here: #902 (comment)

OpenMP lib dependency causes test failure.

To Reproduce

$ pip install -e .[test]
$ pytest tests
ImportError while loading conftest '/Users/vanderplas/github/uber/causalml/tests/conftest.py'.
tests/conftest.py:4: in <module>
    from causalml.dataset import synthetic_data
causalml/dataset/__init__.py:10: in <module>
    from .synthetic import get_synthetic_preds, get_synthetic_preds_holdout
causalml/dataset/synthetic.py:10: in <module>
    from xgboost import XGBRegressor
.venv/lib/python3.14/site-packages/xgboost/__init__.py:6: in <module>
    from . import tracker  # noqa
    ^^^^^^^^^^^^^^^^^^^^^
.venv/lib/python3.14/site-packages/xgboost/tracker.py:9: in <module>
    from .core import _LIB, _check_call, _deprecate_positional_args, make_jcargs
.venv/lib/python3.14/site-packages/xgboost/core.py:309: in <module>
    _LIB = _load_lib()
           ^^^^^^^^^^^
.venv/lib/python3.14/site-packages/xgboost/core.py:273: in _load_lib
    raise XGBoostError(f"""
E   xgboost.core.XGBoostError:
E   XGBoost Library (libxgboost.dylib) could not be loaded.
E   Likely causes:
E     * OpenMP runtime is not installed
E       - vcomp140.dll or libgomp-1.dll for Windows
E       - libomp.dylib for Mac OSX
E       - libgomp.so for Linux and other UNIX-like OSes
E       Mac OSX users: Run `brew install libomp` to install OpenMP runtime.
E
E     * You are running 32-bit Python on a 64-bit OS
E
E   Error message(s): ["dlopen(/Users/vanderplas/github/uber/causalml/.venv/lib/python3.14/site-packages/xgboost/lib/libxgboost.dylib, 0x0006): Library not loaded: @rpath/libomp.dylib\n  Referenced from: <1A0D8152-BF46-3BE0-B651-EE965C187777> /Users/vanderplas/github/uber/causalml/.venv/lib/python3.14/site-packages/xgboost/lib/libxgboost.dylib\n  Reason: tried: '/opt/homebrew/opt/libomp/lib/libomp.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/opt/libomp/lib/libomp.dylib' (no such file), '/opt/homebrew/opt/libomp/lib/libomp.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/opt/libomp/lib/libomp.dylib' (no such file)"]

Expected behavior
Success

Environment (please complete the following information):
Note OP comment:

I cannot use brew on this particular computer, and in a few minutes of searching around I couldn't find any way around this.

  • OS: [macOS]

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions