crewAIInc/crewAI · error · SystemExit

Running declarative flows requires the full crewai package.

Error message

Running declarative flows requires the full crewai package.

What it means

Raised inside load_declarative_flow() when `from crewai.flow.flow import Flow` fails with ImportError. As with reset-memories, the crewai-cli package can be installed without the crewai core; declarative flows require the core Flow class. The CLI prints the message to stderr and exits 1 chained to the ImportError.

Source

Thrown at lib/cli/src/crewai_cli/run_declarative_flow.py:420

        flow = load_declarative_flow(definition)
        flow.plot()
    except Exception as exc:
        click.echo(
            f"An error occurred while plotting the declarative flow: {exc}", err=True
        )
        raise SystemExit(1) from exc


def load_declarative_flow(definition: str | Path) -> Any:
    """Load a declarative Flow instance from a definition path."""
    try:
        from crewai.flow.flow import Flow
    except ImportError as exc:
        click.echo(
            "Running declarative flows requires the full crewai package.",
            err=True,
        )
        raise SystemExit(1) from exc

    definition_path = Path(definition).expanduser()
    try:
        if not definition_path.is_file():
            if definition_path.exists():
                click.echo(
                    f"Invalid --definition path: {definition} is not a file.",
                    err=True,
                )
                raise SystemExit(1)
            click.echo(
                f"Invalid --definition path: {definition} does not exist.", err=True
            )
            raise SystemExit(1)
    except OSError as exc:
        click.echo(f"Invalid --definition path: {definition} ({exc})", err=True)
        raise SystemExit(1) from exc

View on GitHub (pinned to 754d7323be)

Solutions

  1. Install the full package: `pip install crewai` (or `uv add crewai` / recreate the venv with the project lockfile).
  2. Verify with `python -c "from crewai.flow.flow import Flow"` in the same environment the CLI uses.
  3. If installation of crewai fails, resolve that first (Python version, missing build deps) — the CLI error is only a symptom.

Example fix

# before
$ crewai flow run --definition flow.yaml
# Running declarative flows requires the full crewai package.

# after
$ pip install crewai
$ crewai flow run --definition flow.yaml
Defensive patterns

Strategy: fallback

Validate before calling

import importlib.util

if importlib.util.find_spec("crewai.flow.flow") is None:
    raise SystemExit("crewai core missing; run: pip install crewai")

Prevention

When it happens

Trigger: Running `crewai flow run --definition ...` or `crewai flow plot` in an environment with only crewai-cli installed; venvs where crewai core was uninstalled or failed to install due to platform wheels; pipx installs of the bare CLI.

Common situations: Slim Docker images intended only for scaffolding; CI caching that restored a venv without crewai; dependency conflicts downgrading/removing crewai.

Related errors


AI-assisted analysis of crewAIInc/crewAI@754d7323be (2026-08-15). Data as JSON: /api/errors/3bc931e678714778. Report an issue: GitHub.