Skip to content

[Bugfix] Segmentation fault for darts[all] on macOS arm64#3050

Open
daidahao wants to merge 1 commit intounit8co:masterfrom
daidahao:fix/macos-libomp
Open

[Bugfix] Segmentation fault for darts[all] on macOS arm64#3050
daidahao wants to merge 1 commit intounit8co:masterfrom
daidahao:fix/macos-libomp

Conversation

@daidahao
Copy link
Copy Markdown
Contributor

@daidahao daidahao commented Mar 27, 2026

Checklist before merging this PR:

  • Mentioned all issues that this PR fixes or addresses.
  • Summarized the updates of this PR under Summary.
  • Added an entry under Unreleased in the Changelog.

Fixes #.

Summary

torch (latest, 2.11) bundled libomp is not compatible with lightgbm (latest, 4.6.0) on macOS arm64, causing segmentation faults:

from darts.models import LightGBMModel
from darts.utils.timeseries_generation import linear_timeseries

series = linear_timeseries(length=100)
model = LightGBMModel(12).fit(series)

Related Issue:

Until it is fixed on either side, I suggest capping the torch version to 2.10.

Other Information

Co-authored-by: Zhihao Dai <zhihao.dai@eng.ox.ac.uk>
@daidahao daidahao requested a review from dennisbader as a code owner March 27, 2026 18:46
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.69%. Comparing base (ac01d25) to head (f22de6a).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3050      +/-   ##
==========================================
- Coverage   95.75%   95.69%   -0.07%     
==========================================
  Files         158      158              
  Lines       17229    17229              
==========================================
- Hits        16498    16487      -11     
- Misses        731      742      +11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@dennisbader
Copy link
Copy Markdown
Collaborator

Thanks @daidahao. I'm not sure how quickly (I would assume it's LightGBM) resolves this issue. For me (also mac user), setting the env variable to the brew installed libomp resolved this issue:

# Only add libomp to DYLD_LIBRARY_PATH if Homebrew and libomp are installed
if command -v brew &>/dev/null; then
    _libomp="$(brew --prefix libomp 2>/dev/null)/lib"
    [ -d "$_libomp" ] && export DYLD_LIBRARY_PATH="${_libomp}${DYLD_LIBRARY_PATH:+:$DYLD_LIBRARY_PATH}"
    unset _libomp
fi

@daidahao
Copy link
Copy Markdown
Contributor Author

daidahao commented Apr 7, 2026

@dennisbader

Thank you for the suggestion and I can confirm it fixes the problem for me!

Would it be helpful to include it in INSTALL.md or pin the solution to Issues so users could find it easily? I think it affects new fresh install of darts[all] on macOS, even when torch models are not imported (see snippet above).

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

Successfully merging this pull request may close these issues.

2 participants