Skip to content

macOS arm64: kernel dies on import mlfinlab #549

@sachin80

Description

@sachin80

Hi team,

I'm trying to run mlfinlab and the supporting notebooks. So far, importing mlfinlab on macos (Apple Silicon, arm64) consistently kills Python. The import log shows the last line as:

import 'mlfinlab.pytransform' ...

After that, the Python interpreter terminates with no traceback.

Environment:

  • MacBook Pro, Apple Silicon (arm64)
  • macOS 15 (Sequoia)
  • Conda distro: Miniforge at ~/miniforge3
  • Python versions of mlfinlab tried in clean envs: 3.8, 3.9 (primary), 3.10, 3.11
  • Install wheels for matching Python versions (py38 / py39 / py310 / py311)
  • MLFINLAB_API_KEY is exported and visible to Python

What works:

  • Core libraries import fine: numpy, pandas, scikit-learn, numba, llvmlite, statsmodels
  • Solvers import fine: cvxpy, scs, osqp, ecos
  • The crash happens only on import mlfinlab

Short reproduction

conda create -n mlfinlab39 python=3.9 -y
conda activate mlfinlab39
# Used conda-forge in this env only and set strict priority.
# Rationale: on Apple Silicon (arm64), conda-forge provides the most up to date numerical libraries. 
# Strict priority avoids mixing up with defaults that cause mismatches and import crashes
conda config --env --add channels conda-forge
conda config --env --set channel_priority strict
conda install -c conda-forge numpy pandas scipy scikit-learn statsmodels numba llvmlite cython cmake pkg-config -y
export MLFINLAB_API_KEY="<redacted>"
# Install wheel matching Python 3.9
python -m pip install "mlfinlab @ <py39-wheel-url>"
# Show the last imports before the Python interpreter terminates
python -X faulthandler -v -c "import mlfinlab" 2>&1 | tail -n 80

Key tail from -v

# ... stdlib imports ...
# /.../site-packages/mlfinlab/__init__.py
# /.../site-packages/mlfinlab/pytransform/__init__.py
import 'mlfinlab.pytransform' # <_frozen_importlib_external.SourceFileLoader ...>
# <-- process is killed here (no Python traceback)
  • Also reproducible in the tutorial notebook. Launching Getting_Started.ipynb in VS Code and running import mlfinlab immediately crashes the kernel (screenshot attached).

Additionally

  • Tried with and without mlfinlab extras
  • Tried NUMBA_DISABLE_JIT=1, OMP_NUM_THREADS=1, VECLIB_MAXIMUM_THREADS=1
  • Miniconda vs Miniforge

I was told that Linux works fine with the same wheel, which seems to point to potentially a macOS arm64 packaging/runtime issue (pytransform?) rather than my environment.

Could you provide a working wheel for macOS 15 (Sequoia) on arm64, or guidance on how to correctly install mlfinlab?

Thanks,
Sachin

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions