Skip to content

ModuleNotFoundError: No module named 'pygments.lexers.data' #196

@rysweet

Description

@rysweet

Problem

Amplifier execution fails with module import error for pygments.lexers.data:

Error: No module named 'pygments.lexers.data'

Context

  • Environment: uv tool installed amplifier
  • Trigger: Unknown (error reported by user during amplihack testing)
  • Impact: Blocks amplifier execution when pygments lexer is needed

Expected Behavior

Pygments should be properly installed with all required submodules including pygments.lexers.data.

Verification

Local testing shows the module EXISTS in both environments:

# Local Python
$ python3 -c "import pygments.lexers.data; print(pygments.lexers.data.__file__)"
/home/azureuser/.cache/uv/.../pygments/lexers/data.py

# Amplifier UV Tool Environment  
$ /home/azureuser/.local/share/uv/tools/amplifier/bin/python3 -c "import pygments.lexers.data"
/home/azureuser/.local/share/uv/tools/amplifier/lib/python3.12/site-packages/pygments/lexers/data.py

Module exists but error still reported.

Possible Causes

  1. Incomplete pygments installation: Some pygments subpackages missing in certain conditions
  2. Import order issue: Module imported before pygments fully initialized
  3. Version mismatch: Incompatible pygments version
  4. Platform-specific issue: Error only on certain Python versions or platforms

Reproduction

Unable to reproduce consistently. Error occurred during recipe execution but exact trigger unknown.

Recommended Investigation

  1. Add pygments to explicit dependencies with version pin
  2. Add import verification test in CI
  3. Check which amplifier component imports pygments.lexers.data
  4. Verify pygments installation completeness in uv tool environment

Impact

  • Severity: MEDIUM (blocks execution when triggered)
  • Frequency: LOW (inconsistent reproduction)
  • Workaround: Reinstall amplifier or pygments

Related

User reported during amplihack recipe testing. May be related to bundle loading or tool initialization.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions