Skip to content

CLI requires heavy optional dependencies (matplotlib, scipy) for basic operations #65

@turbomam

Description

@turbomam

Environment

  • OS: Ubuntu 24 on Intel
  • linkml-store version: 0.3.0rc3
  • Python: 3.11

Problem

Running a basic query command requires installing analytics and scipy extras, even though the query has nothing to do with plotting or scientific computing.

Minimal reproduction

uv sync  # base install only
uv run linkml-store -d "dremio-rest://lakehouse.jgi.lbl.gov" -c mytable query -l 3 -O csv

Error:

ModuleNotFoundError: No module named 'matplotlib'

After installing --extra analytics:

ModuleNotFoundError: No module named 'scipy'

Root cause

cli.py line 28 has an unconditional import:

from linkml_store.plotting.cli import plot_cli

This import chain requires:

  • matplotlib (from analytics extra)
  • scipy (from scipy extra, but not included in analytics)

Additional warnings without more extras

Even after installing analytics + scipy, there are warnings unless you also install llm and map extras:

Error importing linkml_store.inference.implementations.llm_inference_engine: No module named 'llm'
Error importing linkml_store.inference.implementations.sklearn_inference_engine: No module named 'linkml_map'
Error importing linkml_store.inference.implementations.rag_inference_engine: No module named 'llm'
Error importing linkml_store.inference.implementations.rule_based_inference_engine: No module named 'linkml_map'

Current workaround

Must install 4 extras for a clean basic query:

uv sync --extra analytics --extra scipy --extra llm --extra map

Suggested fixes

  1. Lazy imports for plotting and inference modules - only import when those subcommands are invoked
  2. Fix analytics extra to include scipy since plotting/heatmap.py requires it
  3. Silence or demote the inference engine import errors to debug level when those features aren't being used

Impact

The README shows pip install linkml-store[all] which works, but users trying to install minimal dependencies for specific use cases (e.g., just dremio-rest queries) hit confusing errors.

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