#4065·Nuitka

compilation crash cause lazy-loader 0.6 no longer expose _StubVisitor

Author: MLaurenceFournierCreated Sep 28, 2026Updated Sep 28, 2026

Bug Description

NuitkaPluginImplicitImports._handleLazyLoad uses lazy_loader._StubVisitor which is no longer accessible since version 0.6 of lazy-loader (now hidden in attach_stub).

See https://github.com/Nuitka/Nuitka/blob/80987a6a967635e2d30c6e2dfd547a5c19cbd370/nuitka/plugins/standard/ImplicitImports.py#L698 https://github.com/scientific-python/lazy-loader/blob/2566bebe6a36ecd0bc5dc5a69e8767f7e68fb6d0/src/lazy_loader/__init__.py#L279 https://github.com/scientific-python/lazy-loader/blob/9245da7b993149c76a21b56c2ecc95dacc3cbea6/src/lazy_loader/__init__.py#L363

️ Environment

You can use this conda environment to reproduce the bug. I'm on windows 11 with micromamba, but I don't think it matters.

name: nuitka_lazy_loader_bug
channels:
  - conda-forge
  - nodefaults
dependencies:
  - python=3.13
  - scikit-image=0.26.0
  - lazy-loader=0.6
  - nuitka=4.2.2

2. How Nuitka and Python were Installed

conda (specifically micromamba in my case)

3. Relevant PyPI Packages and Versions

see minimal environment

️ To Reproduce

You can use the following minimal program which I shall call main.py for the rest.

from skimage import feature

print(feature.canny)

2. Short, Self-Contained, Correct, Eligible (SSCCE) Example

see previous sections

3. Nuitka Command Line Options

With your minimal conda environment activated,

nuitka main.py

Expected Behavior

no errors and a compiled program

Actual Behavior & Output

an exception equivalent to this:

  File "E:\conda_cache\envs\nuitka_lazy_loader_bug\Lib\site-packages\nuitka\plugins\Plugins.py", line 110, in withPluginProblemReporting
    yield
  File "E:\conda_cache\envs\nuitka_lazy_loader_bug\Lib\site-packages\nuitka\plugins\Plugins.py", line 1160, in onModuleSourceCode
    new_source_code = plugin.onModuleSourceCode(
        module_name=module_name,
        source_filename=source_filename,
        source_code=source_code,
    )
  File "E:\conda_cache\envs\nuitka_lazy_loader_bug\Lib\site-packages\nuitka\plugins\standard\ImplicitImports.py", line 467, in onModuleSourceCode
    result = self._handleLazyLoad(
        module_name=module_name,
        source_filename=source_filename,
    )
  File "E:\conda_cache\envs\nuitka_lazy_loader_bug\Lib\site-packages\nuitka\plugins\standard\ImplicitImports.py", line 695, in _handleLazyLoad
    visitor = lazy_loader._StubVisitor()
              ^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: module 'lazy_loader' has no attribute '_StubVisitor'

↩️ Regression (if applicable)

The current workaround is to pin lazy-loader to version 0.5.