calesthio/OpenMontage · error · DependencyError

Python module {module_name!r} not installed. {self.install_i

Error message

Python module {module_name!r} not installed. {self.install_instructions}

What it means

Raised by BaseTool.check_dependencies when a dependency declared with the python: prefix fails to import. The tool does __import__(module_name) and converts ImportError into DependencyError with the module name and install_instructions. Note the check imports the top-level module only; a module that imports but lacks a required sub-dependency can pass this check and fail later.

Source

Thrown at tools/base_tool.py:325

            if dep.startswith(("cmd:", "binary:")):
                prefix = "cmd:" if dep.startswith("cmd:") else "binary:"
                cmd_name = dep[len(prefix):]
                if shutil.which(cmd_name) is None:
                    raise DependencyError(
                        f"Command {cmd_name!r} not found. {self.install_instructions}"
                    )
            elif dep.startswith("env:"):
                env_name = dep[4:]
                if not os.environ.get(env_name):
                    raise DependencyError(
                        f"Environment variable {env_name!r} not set. {self.install_instructions}"
                    )
            elif dep.startswith("python:"):
                module_name = dep[7:]
                try:
                    __import__(module_name)
                except ImportError:
                    raise DependencyError(
                        f"Python module {module_name!r} not installed. {self.install_instructions}"
                    )

    def get_info(self) -> dict[str, Any]:
        """Return full tool contract info for registry/discovery."""
        usage_location = inspect.getfile(self.__class__)
        return {
            "name": self.name,
            "version": self.version,
            "tier": self.tier.value,
            "capability": self.capability,
            "provider": self.provider,
            "stability": self.stability.value,
            "status": self.get_status().value,
            "execution_mode": self.execution_mode.value,
            "determinism": self.determinism.value,
            "runtime": self.runtime.value,
            "module_path": self.__class__.__module__,

View on GitHub (pinned to 95e1c3d0ab)

Solutions

  1. Install the package into the interpreter that runs the tool: python -m pip install <module>
  2. Verify with the same interpreter: python -c "import <module>"
  3. If a local file shadows the module name, rename it
  4. Confirm the venv is active in the process that executes the tool (services often need absolute venv paths)

Example fix

# before
result = tool.run(inputs)  # DependencyError: Python module 'moviepy' not installed

# after (same interpreter as the tool run)
# python -m pip install moviepy
result = tool.run(inputs)
Defensive patterns

Strategy: validation

Validate before calling

for d in tool.dependencies:
    if d.startswith("python:"):
        try:
            __import__(d[7:])
        except ImportError:
            raise SystemExit(f"install {d[7:]} into this interpreter: python -m pip install {d[7:]}")
# or: assert tool.check_available() is ToolStatus.AVAILABLE

Type guard

def tool_python_modules_importable(tool) -> bool:
    for d in tool.dependencies:
        if d.startswith("python:"):
            try:
                __import__(d[7:])
            except ImportError:
                return False
    return True

Try / catch

from tools.base_tool import DependencyError
try:
    tool.check_dependencies()
except DependencyError as e:
    if "Python module" in str(e):
        run("python -m pip install " + extract_module(e))
        tool.check_dependencies()  # re-verify
    raise

Prevention

When it happens

Trigger: A tool declaring e.g. 'python:whisper' or 'python:moviepy' running in an environment where the package is not installed, installed under a different interpreter (pip vs pip3, another venv), or shadowed by a broken install that raises ImportError.

Common situations: Virtualenv not activated in the running process; the package installed with --user for a different Python minor version; a partially corrupted site-packages entry; name shadowing by a local file with the same module name.

Related errors


AI-assisted analysis of calesthio/OpenMontage@95e1c3d0ab (2026-08-15). Data as JSON: /api/errors/2aaf210aed8c485e. Report an issue: GitHub.