Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatibility problem with numpy 2.0.0 #40

Open
royess opened this issue Jun 18, 2024 · 7 comments
Open

Incompatibility problem with numpy 2.0.0 #40

royess opened this issue Jun 18, 2024 · 7 comments

Comments

@royess
Copy link

royess commented Jun 18, 2024

Incompatible problem with the newly released numpy 2.0.0 (https://pypi.org/project/numpy/2.0.0/#history).

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/yuxuan/anaconda3/envs/ldpc/lib/python3.12/site-packages/ldpc/__init__.py", line 2, in <module>
    from .bp_decoder import bp_decoder
  File "src/ldpc/bp_decoder.pyx", line 1, in init ldpc.bp_decoder
ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject

Versions: python==3.12, ldpc==0.1.51, numpy=2.0.0, scipy==1.13.1

quantumgizmos added a commit that referenced this issue Jun 19, 2024
… fix for #40. Alternative to lower bounding numpy version as suggested in #41. Needs testing
@quantumgizmos
Copy link
Owner

Hi. Thanks for pointing this out. I think the problem is that that numpy 2.0.0 doesn't support the np.int_t type for some reason. I've changed the default output type to np.uint8_t and it seems to work for me locally. Could you test the fix in branch issue40?

@royess
Copy link
Author

royess commented Jun 19, 2024

The new branch seems to work well. It no longer triggers errors. I also tested decoding a small repetition code, which returned an expected result. Thanks for this fixing!

@burgholzer
Copy link
Contributor

Any chance of getting this fix merged and released as a new version (before the v2 release)?
That will also directly fix #43.

Potentially, besides the fix for numpy 2.0 compatibility, wheels for Python 3.12 would be great and should be easy to do.

@quantumgizmos quantumgizmos mentioned this issue Sep 2, 2024
@quantumgizmos
Copy link
Owner

@burgholzer I've made pull request #44 to ship this? Could you confirm it works in your environment? Then it can be shipped 🚢

@burgholzer
Copy link
Contributor

uv venv --python 3.12 .venv312
source .venv312/bin/activate
uv pip install git+https://github.com/quantumgizmos/ldpc@issue40

succeeds without issues om my Linux machine as well as my Windows and my Apple arm64 machine.
Also briefly tested the new version over in our QECC repo and everything builds fine and also runs fine.
So definitely "go" from my side.

@quantumgizmos
Copy link
Owner

Thanks @burgholzer pr #44 is now integrated and uploaded to PyPi!

@burgholzer
Copy link
Contributor

Many thanks 🙏🏼
Already integrated the new version in mqt-qecc and it works like a charm ✨

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 a pull request may close this issue.

3 participants