{"record":{"id":"9a41f557c8c1fccf","repo":"reflex-dev/reflex","slug":"yaml-support-is-not-available-please-install-pyya","errorCode":null,"errorMessage":"YAML support is not available. Please install PyYAML to use this feature.","messagePattern":"YAML support is not available\\. Please install PyYAML to use this feature\\.","errorType":"validation","errorClass":"ConfigError","httpStatus":null,"severity":"error","filePath":"packages/reflex-hosting-cli/src/reflex_cli/core/config.py","lineNumber":219,"sourceCode":"\n        Args:\n            yaml_path: The path to the YAML file. Defaults to \"cloud.yml\" in the current directory.\n            env: The environment to load the config for.\n\n        Returns:\n            Config: A Config instance with the values from the YAML file.\n\n        Raises:\n            ConfigError: If the YAML file is not found.\n\n        \"\"\"\n        if not yaml_path.exists():\n            raise ConfigError(f\"Config file not found at {yaml_path}.\")\n\n        try:\n            import yaml\n        except ImportError as e:\n            raise ConfigError(\n                \"YAML support is not available. Please install PyYAML to use this feature.\"\n            ) from e\n\n        with yaml_path.open() as file:\n            data = yaml.safe_load(file)\n            if env:\n                data = data.get(\"env\", {}).get(env, {})\n            data = cls._filter_dict(data)\n        return cls(_cloud_config_path=yaml_path, **data)\n\n    @classmethod\n    def from_toml(\n        cls,\n        pyproject_path: Path = Path.cwd() / \"pyproject.toml\",\n        env: str | None = None,\n    ) -> Config:\n        \"\"\"Creates a Config instance from a TOML file.\n","sourceCodeStart":201,"sourceCodeEnd":237,"githubUrl":"https://github.com/reflex-dev/reflex/blob/45b8ed5ab735f8a56bbb09a42384f030eb0208e7/packages/reflex-hosting-cli/src/reflex_cli/core/config.py#L201-L237","documentation":"ConfigError raised when the PyYAML module cannot be imported while loading a YAML config. The hosting CLI keeps PyYAML as an optional dependency, so YAML config loading fails on environments where it isn't installed.","triggerScenarios":"Calling CloudConfig.from_yaml (directly or via from_yaml_or_toml_or_none/read_config) in an environment where the pyyaml package is not installed.","commonSituations":"Installing reflex-hosting-cli with [no-any-extras] or a stripped dependency set; using a restricted corporate environment where PyYAML is blocked; running in a minimal container.","solutions":["Install PyYAML in the active environment (uv add pyyaml / pip install pyyaml, or reinstall reflex-hosting-cli with its yaml extra)","Alternatively switch your config to pyproject.toml ([tool.reflex-cloud]) which uses the stdlib tomllib"],"exampleFix":"# before: ConfigError: YAML support is not available...\nconfig = CloudConfig.from_yaml(path)\n\n# after\n# shell: pip install pyyaml\nconfig = CloudConfig.from_yaml(path)","handlingStrategy":"fallback","validationCode":"try:\n    import yaml  # noqa: F401\n    HAS_YAML = True\nexcept ImportError:\n    HAS_YAML = False\nif HAS_YAML:\n    config = CloudConfig.from_yaml(path)\nelse:\n    config = CloudConfig.from_toml(pyproject_path)  # or install pyyaml","typeGuard":null,"tryCatchPattern":"try:\n    config = CloudConfig.from_yaml(path)\nexcept ConfigError as e:\n    if \"PyYAML\" in str(e):\n        config = CloudConfig.from_toml(Path(\"pyproject.toml\"))\n    else:\n        raise","preventionTips":["Install pyyaml alongside reflex-hosting-cli","Prefer pyproject.toml config in minimal environments","Pin extras in your deployment requirements: reflex-hosting-cli[yaml]"],"tags":["dependencies","yaml","import-error","reflex-hosting-cli"],"backgroundTag":"missing-optional-dependency","analyzedSha":"45b8ed5ab735f8a56bbb09a42384f030eb0208e7","analyzedAt":"2026-08-28T19:25:27.644Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}