Skip to content

Segfault on M1 when loading Python Package MNE. #315

Open
@palday

Description

@palday

Affects: PythonCall

Describe the bug
On M1, I can reliably induce a segfault when loading the Python package mne via PythonCall.

(@v1.9) pkg> activate --temp
  Activating new project at `/var/folders/yy/nyj87tsn7093bb7d84rl64rh0000gp/T/jl_TKDOuI`

julia> versioninfo()
Julia Version 1.9.0
Commit 8e630552924 (2023-05-07 11:25 UTC)
Platform Info:
  OS: macOS (arm64-apple-darwin22.4.0)
  CPU: 8 × Apple M1
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-14.0.6 (ORCJIT, apple-m1)
  Threads: 1 on 4 virtual cores

(jl_TKDOuI) pkg> add CondaPkg PythonCall
   Resolving package versions...
    Updating `/private/var/folders/yy/nyj87tsn7093bb7d84rl64rh0000gp/T/jl_TKDOuI/Project.toml`
  [992eb4ea] + CondaPkg v0.2.18
  [6099a3de] + PythonCall v0.9.13
...

julia> using CondaPkg

(jl_TKDOuI) pkg> conda add mne

julia> using PythonCall

julia> pyimport("mne")

[16152] signal (11.2): Segmentation fault: 11
in expression starting at REPL[7]:1
_ZN4llvm17PMTopLevelManager16addImmutablePassEPNS_13ImmutablePassE at /private/var/folders/yy/nyj87tsn7093bb7d84rl64rh0000gp/T/jl_TKDOuI/.CondaPkg/env/lib/libLLVM-14.dylib (unknown line)
Allocations: 7988242 (Pool: 7981782; Big: 6460); GC: 13

Your system
Please provide detailed information about your system:

julia> versioninfo()
Julia Version 1.9.0
Commit 8e630552924 (2023-05-07 11:25 UTC)
Platform Info:
  OS: macOS (arm64-apple-darwin22.4.0)
  CPU: 8 × Apple M1
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-14.0.6 (ORCJIT, apple-m1)
  Threads: 1 on 4 virtual cores

Additional context

  • I suspect this might be related to Import Python submodules crashes Julia #291, but that issue lacked sufficient detail to know for sure.
  • I am unable to replicate this problem with a few other related python packages (matplotlib, fooof, neurodsp) on M1.
  • The issue is not present on x86-64.
  • Running Python (from the .CondaPkg/env) and importing MNE directly does not cause a segfault.
  • Installing MNE from pip instead of Conda resolves the issue.

I think there's some weird interaction between the Conda build, LLVM dylib and PythonCall.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions