Skip to content

Critical Build Failures and Destructive Compilation Script in quantcrypt v1.0.1 on Linux (Python 3.13) #16

@ThunderD9

Description

@ThunderD9

I tried to run this in debain(docker - python:3.13-bookworm) and it failed, this is the error i am getting:

from quantcrypt.dss import MLDSA_87

dss = MLDSA_87()
Traceback (most recent call last):
File "/usr/local/lib/python3.13/site-packages/quantcrypt/internal/pqa/common.py", line 81, in init
self._lib = self._import(self.variant)
~~~~~~~~~~~~^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/quantcrypt/internal/pqa/common.py", line 76, in _import
return importlib.import_module(module_path).lib
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/importlib/init.py", line 88, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 1387, in _gcd_import
File "", line 1360, in _find_and_load
File "", line 1310, in _find_and_load_unlocked
File "", line 488, in _call_with_frames_removed
File "", line 1387, in _gcd_import
File "", line 1360, in _find_and_load
File "", line 1324, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'quantcrypt.internal.bin'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "", line 1, in
dss = MLDSA_87()
File "/usr/local/lib/python3.13/site-packages/pydantic/_internal/_validate_call.py", line 39, in wrapper_function
return wrapper(*args, **kwargs)
File "/usr/local/lib/python3.13/site-packages/pydantic/_internal/_validate_call.py", line 136, in call
res = self.pydantic_validator.validate_python(pydantic_core.ArgsKwargs(args, kwargs))
File "/usr/local/lib/python3.13/site-packages/quantcrypt/internal/pqa/dss_algos.py", line 81, in init
super().init(variant, allow_fallback)
~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.13/site-packages/quantcrypt/internal/pqa/common.py", line 90, in init
raise errors.PQAImportError(self.spec, self.variant)
quantcrypt.internal.errors.PQAImportError: Failed to import clean binaries of the MLDSA_87 algorithm.

Description:

The quantcrypt library (v1.0.1) exhibits a series of critical issues when installed in a standard Linux environment (Debian Bookworm, Python 3.13), making it unusable without significant and undocumented workarounds. The installation process is misleading, the provided compilation tools are broken, and the primary build script is destructive to the Python environment.

Environment:

Library Version: quantcrypt==1.0.1
Operating System: Debian 12 "Bookworm" (via python:3.13-bookworm Docker image)
Python Version: 3.13.4
Installation Method: pip within a Docker build

Summary of Issues

Failure to Install Precompiled Binaries: Despite claims of shipping with precompiled binaries, pip install quantcrypt does not install them for Python 3.13 on Linux. This immediately causes a ModuleNotFoundError: No module named 'quantcrypt.internal.bin' at runtime.

Misleading [compiler] Extra: The documented pip install "quantcrypt[compiler]" command does not trigger a compilation of the native binaries. It only installs the qclib command-line tool. The build process is still skipped, leading to the same runtime error.

Unreachable Pure-Python Fallback: The allow_fallback=True parameter is ineffective. The library attempts to import quantcrypt.internal.bin before checking this flag, causing a PQAImportError and making the pure-Python implementation unreachable if binaries were never compiled.

Destructive Manual Compilation Script: The undocumented manual build step, qclib compile, is catastrophically broken. After execution, it deletes or corrupts the Python interpreter executable that was used to run it, making further python or pip commands fail with No such file or directory.

Chronological Investigation and Failed Solutions

This section details the logical progression of debugging steps undertaken to resolve the initial ModuleNotFoundError. Each step revealed a deeper issue with the library.

Attempt 1: Standard Installation
Action: pip install quantcrypt
Result: Installation succeeds, but fails at runtime with ModuleNotFoundError: No module named 'quantcrypt.internal.bin'.
Conclusion: Precompiled binaries are not available for this platform.

Attempt 2: Use [compiler] Extra (The Documented Method)
Action: Install build tools (build-essential, cmake, etc.) and run pip install "quantcrypt[compiler]".
Result: Build succeeds with no errors, but the runtime error persists.
Conclusion: The [compiler] extra does not trigger the C extension build as expected.

Attempt 3: Use the Pure-Python Fallback
Action: Instantiate with MLDSA_87(allow_fallback=True).
Result: The exact same PQAImportError occurs.
Conclusion: The fallback mechanism is broken and cannot be used to bypass the need for compiled binaries.

Attempt 4: Manual Compilation with qclib
Action: After installation, manually run qclib compile inside the container.
Result: The compile command reports ✔ - Operation successful!. However, subsequent attempts to run python or python3.13 in the same shell session fail with bash: /usr/local/bin/python: No such file or directory.
Conclusion: The qclib script is the correct way to trigger a build, but it is dangerously destructive to the Python environment it runs in.

Attempt 5: Force Correct Python Interpreter
Observation: The python:3.13-bookworm image contains both python3.13 and the system's python3.11. The qclib script appeared to be incorrectly using python3.11.
Action: Explicitly run the compilation with the correct interpreter: python3.13 $(which qclib) compile --no-ask.
Result: The compilation still reports success, but it still deletes the python3.13 executable, proving the script's destructive nature is tied to the interpreter that runs it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions