{"record":{"id":"3bc931e678714778","repo":"crewAIInc/crewAI","slug":"running-declarative-flows-requires-the-full-crewai","errorCode":null,"errorMessage":"Running declarative flows requires the full crewai package.","messagePattern":"Running declarative flows requires the full crewai package\\.","errorType":"console","errorClass":"SystemExit","httpStatus":null,"severity":"error","filePath":"lib/cli/src/crewai_cli/run_declarative_flow.py","lineNumber":420,"sourceCode":"        flow = load_declarative_flow(definition)\n        flow.plot()\n    except Exception as exc:\n        click.echo(\n            f\"An error occurred while plotting the declarative flow: {exc}\", err=True\n        )\n        raise SystemExit(1) from exc\n\n\ndef load_declarative_flow(definition: str | Path) -> Any:\n    \"\"\"Load a declarative Flow instance from a definition path.\"\"\"\n    try:\n        from crewai.flow.flow import Flow\n    except ImportError as exc:\n        click.echo(\n            \"Running declarative flows requires the full crewai package.\",\n            err=True,\n        )\n        raise SystemExit(1) from exc\n\n    definition_path = Path(definition).expanduser()\n    try:\n        if not definition_path.is_file():\n            if definition_path.exists():\n                click.echo(\n                    f\"Invalid --definition path: {definition} is not a file.\",\n                    err=True,\n                )\n                raise SystemExit(1)\n            click.echo(\n                f\"Invalid --definition path: {definition} does not exist.\", err=True\n            )\n            raise SystemExit(1)\n    except OSError as exc:\n        click.echo(f\"Invalid --definition path: {definition} ({exc})\", err=True)\n        raise SystemExit(1) from exc\n","sourceCodeStart":402,"sourceCodeEnd":438,"githubUrl":"https://github.com/crewAIInc/crewAI/blob/754d7323beb2fd042e33444a115ea2d5a47193f0/lib/cli/src/crewai_cli/run_declarative_flow.py#L402-L438","documentation":"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.","triggerScenarios":"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.","commonSituations":"Slim Docker images intended only for scaffolding; CI caching that restored a venv without crewai; dependency conflicts downgrading/removing crewai.","solutions":["Install the full package: `pip install crewai` (or `uv add crewai` / recreate the venv with the project lockfile).","Verify with `python -c \"from crewai.flow.flow import Flow\"` in the same environment the CLI uses.","If installation of crewai fails, resolve that first (Python version, missing build deps) — the CLI error is only a symptom."],"exampleFix":"# before\n$ crewai flow run --definition flow.yaml\n# Running declarative flows requires the full crewai package.\n\n# after\n$ pip install crewai\n$ crewai flow run --definition flow.yaml","handlingStrategy":"fallback","validationCode":"import importlib.util\n\nif importlib.util.find_spec(\"crewai.flow.flow\") is None:\n    raise SystemExit(\"crewai core missing; run: pip install crewai\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Install full `crewai` (not only crewai-cli) in environments that run flows.","Add `python -c 'from crewai.flow.flow import Flow'` to CI preflight for flow projects.","Use a lockfile (uv.lock/requirements.txt) so environments are reproducibly complete."],"tags":["installation","import-error","flow","optional-dependency","cli"],"backgroundTag":null,"analyzedSha":"754d7323beb2fd042e33444a115ea2d5a47193f0","analyzedAt":"2026-08-15T04:06:56.746Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}