Repository navigation
fix(backend): report why the _lbug extension failed to load - #72
Merged
adsharma merged 2 commits intoOct 21, 2026
Merged
Conversation
When the bundled _lbug extension fails to import, get_pybind_module() swallows the ImportError and ladybug falls back to the C API backend. If the C API shared library is not present either (the published wheels do not ship it), the user only sees "Could not find lbug C API shared library", which hides the real cause. On macOS the usual cause is a missing OpenSSL 3 runtime: the wheels link /opt/homebrew/opt/openssl@3/lib/libssl.3.dylib and exclude it on purpose. Keep the ImportError and include it in the RuntimeError, with an OpenSSL hint when libssl or libcrypto is the missing library. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When the bundled
_lbugextension fails to import,get_pybind_module()swallows theImportError, and ladybug falls back to the C API backend. The published wheels don't ship the C API shared library, so the user only sees this:The real cause is hidden. On macOS it's usually a missing OpenSSL 3 runtime: the wheels link
/opt/homebrew/opt/openssl@3/lib/libssl.3.dylib, and they exclude OpenSSL on purpose (#724 in LadybugDB/ladybug, and the discussion in LadybugDB/ladybug#681). We hit this on an Apple-silicon Mac without Homebrew, running ladybug 0.19.0 under cognee. The message sent us looking for a C API library we never needed, when the fix was to install OpenSSL 3.Change
_backend.get_pybind_module()keeps theImportError.libsslorlibcrypto, it adds a hint: install OpenSSL 3 (brew install openssl@3on macOS).Example message after the change:
Tests
test/test_backend_errors.pycovers:ruff checkpasses on the changed files.