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

ldpc initialization error due to numpy data type #11

Closed
royess opened this issue Jun 18, 2024 · 2 comments · Fixed by #12
Closed

ldpc initialization error due to numpy data type #11

royess opened this issue Jun 18, 2024 · 2 comments · Fixed by #12

Comments

@royess
Copy link

royess commented Jun 18, 2024

The dependency ldpc raises an initialization error due to the numpy data type.

This is actually an error of the ldpc package, which I have exactly reproduced in Python.

It seems strange because this is a very new bug to me but the ldpc package does not have a new release recently (https://pypi.org/project/ldpc/#history).

To be mentioned, this error also makes the decoder tests of QuantumClifford.jl fail.

The error reads:

julia> using PyQDecoders
ERROR: InitError: Python: ValueError: numpy.dtype size changed, may indicate binary incompatibility. Expected 96 from C header, got 88 from PyObject
Python stacktrace:
 [1] init ldpc.bp_decoder
   @ src/ldpc/bp_decoder.pyx:1
 [2] <module>
   @ ~/.julia/environments/v1.10/.CondaPkg/env/lib/python3.12/site-packages/ldpc/__init__.py:2
Stacktrace:
  [1] pythrow()
    @ PythonCall.Core ~/.julia/packages/PythonCall/S5MOg/src/Core/err.jl:92
  [2] errcheck
    @ ~/.julia/packages/PythonCall/S5MOg/src/Core/err.jl:10 [inlined]
  [3] pyimport(m::String)
    @ PythonCall.Core ~/.julia/packages/PythonCall/S5MOg/src/Core/builtins.jl:1444
  [4] __init__()
    @ PyQDecoders ~/.julia/packages/PyQDecoders/nk69c/src/PyQDecoders.jl:16
  [5] run_module_init(mod::Module, i::Int64)
    @ Base ./loading.jl:1134
  [6] register_restored_modules(sv::Core.SimpleVector, pkg::Base.PkgId, path::String)
    @ Base ./loading.jl:1122
  [7] _include_from_serialized(pkg::Base.PkgId, path::String, ocachepath::String, depmods::Vector{Any})
    @ Base ./loading.jl:1067
  [8] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String, build_id::UInt128)
    @ Base ./loading.jl:1581
  [9] _require(pkg::Base.PkgId, env::String)
    @ Base ./loading.jl:1938
 [10] __require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base ./loading.jl:1812
 [11] #invoke_in_world#3
    @ ./essentials.jl:926 [inlined]
 [12] invoke_in_world
    @ ./essentials.jl:923 [inlined]
 [13] _require_prelocked(uuidkey::Base.PkgId, env::String)
    @ Base ./loading.jl:1803
 [14] macro expansion
    @ ./loading.jl:1790 [inlined]
 [15] macro expansion
    @ ./lock.jl:267 [inlined]
 [16] __require(into::Module, mod::Symbol)
    @ Base ./loading.jl:1753
 [17] #invoke_in_world#3
    @ ./essentials.jl:926 [inlined]
 [18] invoke_in_world
    @ ./essentials.jl:923 [inlined]`
 [19] require(into::Module, mod::Symbol)
    @ Base ./loading.jl:1746
during initialization of module PyQDecoders

@royess
Copy link
Author

royess commented Jun 18, 2024

After some checking, I found this is related to the new changes in numpy 2.0.0 (https://pypi.org/project/numpy/2.0.0/#history).

I have reported this bug to Python ldpc in quantumgizmos/ldpc/issues/40.

To get things temporarily fixed, we may consider degrading numpy version.

@Krastanov
Copy link
Member

a temporary compat bound on numpy would indeed be helpful, probably to be added here https://github.com/QuantumSavory/PyQDecoders.jl/blob/master/CondaPkg.toml as described here https://github.com/JuliaPy/CondaPkg.jl?tab=readme-ov-file#condapkgtoml

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.

2 participants