Skip to content

Make pyccl importable when isitgr is installed but unloadable - #1316

Merged
johannct merged 3 commits into
masterfrom
fix_isitgr_import_oserror
Oct 27, 2026
Merged

johannct merged 3 commits into
masterfrom
fix_isitgr_import_oserror

Conversation

@johannct

Copy link
Copy Markdown
Contributor

An installed but broken isitgr (e.g. an invalid isitgrlib.so, as seen on the macOS arm64 CI runners) raises OSError from dlopen, not ImportError. The guarded import in pyccl/boltzmann.py only caught ModuleNotFoundError, so import pyccl and the whole test suite (conftest) failed.

  • boltzmann.py: catch (ImportError, OSError) on the early isitgr import.
  • tests/conftest.py: skip tests parametrized with boltzmann_isitgr when isitgr cannot be imported (previously they failed).
  • Add a regression test for the broken-isitgr import.

This does not fix the underlying isitgr build on macOS arm64.

@coveralls

coveralls commented Oct 26, 2026 •

Copy link
Copy Markdown

Coverage Report for CI Build 40483085944

Coverage remained the same at 97.471%

Details

  • Coverage remained the same as the base build.
  • Patch coverage: 1 of 1 lines across 1 file are fully covered (100%).
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 6801
Covered Lines: 6629
Line Coverage: 97.47%
Coverage Strength: 4.87 hits per line

💛 - Coveralls

@carlosggarcia carlosggarcia left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I'm worried we may end up in a situation when we'll miss some tests for isitgr when we wouldn't want the tests skipped, but cannot think of a specific example now, so we can face that down the road.

An installed but broken isitgr (e.g. an invalid isitgrlib.so, as seen on
the macOS arm64 CI runners) raises OSError from dlopen, not ImportError.
The guarded import in pyccl/boltzmann.py only caught ModuleNotFoundError,
so `import pyccl` and the whole test suite (conftest) failed.

- boltzmann.py: catch (ImportError, OSError) on the early isitgr import.
- tests/conftest.py: skip tests parametrized with boltzmann_isitgr when
  isitgr cannot be imported (previously they failed).
- Add a regression test for the broken-isitgr import.

This does not fix the underlying isitgr build on macOS arm64.
CFLAGS/LDFLAGS pointed at /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
(a workaround from the macos-10.15/11 images, see #1025), while the compiler
uses the SDK of the active Xcode (xcrun, see SDKROOT).
On the current macos-latest image the Command Line Tools SDK is newer than
the Xcode linker can parse, so the CMake C++ compiler check fails at link
time ("ld: tapi error: malformed file ... libSystem.B.tbd ... unknown
architecture"). Use $SDKROOT for both, consistent with CONDA_BUILD_SYSROOT.
@carlosggarcia
carlosggarcia force-pushed the fix_isitgr_import_oserror branch from aa8d9b7 to c73ee08 Compare October 27, 2026 09:44
@johannct

Copy link
Copy Markdown
Contributor Author

LGTM. I'm worried we may end up in a situation when we'll miss some tests for isitgr when we wouldn't want the tests skipped, but cannot think of a specific example now, so we can face that down the road.

Yes, I think that once the isitgr build is fixed, we should revisit the workflow. But it should not skip isitgr is it is present, and should bark anyway if it is not. So silently skipping is really occurring right now, while isitgr is broken in a specific way. Once the dust settles I am happy to reevaluate

@johannct
johannct merged commit de7b91d into master Oct 27, 2026
12 checks passed
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.

3 participants