Skip to content

PyArrow makes SIGSEGV #16925

Open
Open

Description

Environment

  • Qiskit version: v2.5.0
  • Python version: 3.13.5
  • Operating system: MacOS Tahoe Version 26.5.1 (25F80)
  • PyArrow: 24.0.0

What is happening?

Importing PyArrow 24.0.0 makes simplify() crash, with a SIGSEGV.

How can we reproduce the issue?

Install PyArrow>=24.0.0 and Qiskit>=2.5.0

from qiskit.quantum_info import SparsePauliOp


def main():
    print("Teset before import pyarrow")
    print("before", flush=True)

    op = SparsePauliOp.from_list([
        ("IIII", 0.5),
        ("IIII", 0.5),
        ("IIZZ", 1.0),
        ("IZIZ", 1.0),
        ("ZIIZ", 1.0),
        ("IZZI", 1.0),
        ("ZIZI", 1.0),
        ("ZZII", 1.0),
    ])

    print("before simplify", flush=True)
    op = op.simplify()
    print("after simplify", flush=True)

    import pyarrow
    print("Test after import pyarrow", flush=True)
    print("data loaded")
    print("before", flush=True)

    op = SparsePauliOp.from_list([
        ("IIII", 0.5),
        ("IIII", 0.5),
        ("IIZZ", 1.0),
        ("IZIZ", 1.0),
        ("ZIIZ", 1.0),
        ("IZZI", 1.0),
        ("ZIZI", 1.0),
        ("ZZII", 1.0),
    ])

    print("before simplify", flush=True)
    op = op.simplify()
    print("after simplify", flush=True)

    print("before simplify", flush=True)
    op = op.simplify()
    print("after simplify", flush=True)


if __name__ == "__main__":
    main()

What should happen?

It should run and print:

Teset before import pyarrow
before
before simplify
after simplify
Test after import pyarrow
data loaded
before
before simplify
after simplify
before simplify
after simplify

Instead, it raises a SIGSEGV and prints:

Teset before import pyarrow
before
before simplify
after simplify
Test after import pyarrow
data loaded
before
before simplify

Any suggestions?

Downgroading to PyArrow 23 worked for me, but I don't know why it's related, I didn't investigate the root cause.

Activity

  1. jakelishman commented on Sep 4, 2026

    @jakelishman
    Member

    As best as I can tell, this is a bug in the mimalloc configuration of PyArrow 24 (apache/arrow#50549) and exacerbated by an underlying flaw in mimalloc itself (microsoft/mimalloc#1327). Upgrading to PyArrow 25 or downgrading to 23 should fix it.

    It's not entirely obvious to me if Qiskit also has some sort of latent misconfiguration bug in its mimalloc build (though if we do, it might be something we need to contribute upstream to the Rust mimalloc crate). We could/should probably try and reproduce this by building our own Python extension from Rust using the same sorts of mechanisms as Qiskit, and see if they can both co-exist.

  2. AnitaGeorge404 commented on Sep 24, 2026

    @AnitaGeorge404
    Contributor

    Hii Jake Lishman (@jakelishman), I’d be happy to help with this. I can try reproducing the PyArrow 24/mimalloc interaction using a small Rust/Python extension built similarly to Qiskit, and check whether there’s anything Qiskit-specific that needs fixing or documenting. If that would be useful, could you assign this issue to me?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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