Qiskit / qiskit-addon-mthree

Matrix-free Measurement Mitigation
https://qiskit.github.io/qiskit-addon-mthree/
Apache License 2.0
37 stars 27 forks source link

mthree 2.6.3 wheel raises an error with numpy 2 #212

Closed t-imamichi closed 2 months ago

t-imamichi commented 2 months ago

Importing mthree raises the following error. mthree should add a constraint numpy<2 or compile cython with numpy 2.

import mthree

output

A module that was compiled using NumPy 1.x cannot be run in
NumPy 2.1.0 as it may crash. To support both 1.x and 2.x
versions of NumPy, modules must be compiled with NumPy 2.0.
Some module may need to rebuild instead e.g. with 'pybind11>=2.12'.

If you are a user of the module, the easiest solution will be to
downgrade to 'numpy<2' or try to upgrade the affected module.
We expect that some modules will need time to support NumPy 2.

Traceback (most recent call last):  File "/Users/ima/tasks/4_2024/qiskit/mthree/tmp/import.py", line 1, in <module>
    import mthree
  File "/Users/ima/tasks/4_2024/qiskit/mthree/.venv/lib/python3.12/site-packages/mthree/__init__.py", line 31, in <module>
    from .mitigation import M3Mitigation
  File "/Users/ima/tasks/4_2024/qiskit/mthree/.venv/lib/python3.12/site-packages/mthree/mitigation.py", line 35, in <module>
    from mthree.matrix import _reduced_cal_matrix, sdd_check
Traceback (most recent call last):
  File "/Users/ima/tasks/4_2024/qiskit/mthree/tmp/import.py", line 1, in <module>
    import mthree
  File "/Users/ima/tasks/4_2024/qiskit/mthree/.venv/lib/python3.12/site-packages/mthree/__init__.py", line 31, in <module>
    from .mitigation import M3Mitigation
  File "/Users/ima/tasks/4_2024/qiskit/mthree/.venv/lib/python3.12/site-packages/mthree/mitigation.py", line 35, in <module>
    from mthree.matrix import _reduced_cal_matrix, sdd_check
  File "mthree/matrix.pyx", line 1, in init mthree.matrix
ImportError: numpy.core.multiarray failed to import (auto-generated because you didn't call 'numpy.import_array()' after cimporting numpy; use '<void>numpy._import_array' to disable if you are certain you don't need it).
nonhermitian commented 2 months ago

Yes, we will have to build against NumPy 2+ to support both. This should be completed when I solve #211

nonhermitian commented 2 months ago

This is closed by #217 and should go out in the next release