{"record":{"id":"23e10d7f5c318778","repo":"Lightning-AI/pytorch-lightning","slug":"synchronous-requires-mlflow-2-8-0","errorCode":null,"errorMessage":"`synchronous` requires mlflow>=2.8.0","messagePattern":"`synchronous` requires mlflow>=2\\.8\\.0","errorType":"exception","errorClass":"ModuleNotFoundError","httpStatus":null,"severity":"error","filePath":"src/lightning/pytorch/loggers/mlflow.py","lineNumber":132,"sourceCode":"    LOGGER_JOIN_CHAR = \"-\"\n\n    def __init__(\n        self,\n        experiment_name: str = \"lightning_logs\",\n        run_name: Optional[str] = None,\n        tracking_uri: Optional[str] = os.getenv(\"MLFLOW_TRACKING_URI\"),\n        tags: Optional[dict[str, Any]] = None,\n        save_dir: Optional[str] = \"./mlruns\",\n        log_model: Literal[True, False, \"all\"] = False,\n        prefix: str = \"\",\n        artifact_location: Optional[str] = None,\n        run_id: Optional[str] = None,\n        synchronous: Optional[bool] = None,\n    ):\n        if not _MLFLOW_AVAILABLE:\n            raise ModuleNotFoundError(str(_MLFLOW_AVAILABLE))\n        if synchronous is not None and not _MLFLOW_SYNCHRONOUS_AVAILABLE:\n            raise ModuleNotFoundError(\"`synchronous` requires mlflow>=2.8.0\")\n        super().__init__()\n        if not tracking_uri:\n            tracking_uri = f\"{LOCAL_FILE_URI_PREFIX}{save_dir}\"\n\n        self._experiment_name = experiment_name\n        self._experiment_id: Optional[str] = None\n        self._tracking_uri = tracking_uri\n        self._run_name = run_name\n        self._run_id = run_id\n        self.tags = tags\n        self._log_model = log_model\n        self._logged_model_time: dict[str, float] = {}\n        self._checkpoint_callback: Optional[ModelCheckpoint] = None\n        self._prefix = prefix\n        self._artifact_location = artifact_location\n        self._log_batch_kwargs = {} if synchronous is None else {\"synchronous\": synchronous}\n        self._initialized = False\n","sourceCodeStart":114,"sourceCodeEnd":150,"githubUrl":"https://github.com/Lightning-AI/pytorch-lightning/blob/9fed5c27d2a62ff0efd6c3573599921d6ff67c14/src/lightning/pytorch/loggers/mlflow.py#L114-L150","documentation":"ModuleNotFoundError raised in MLFlowLogger.__init__ when the synchronous argument is used but the installed mlflow version predates the synchronous logging API (added in mlflow 2.8.0). Lightning gates the kwarg on the _MLFLOW_SYNCHRONOUS_AVAILABLE version check.","triggerScenarios":"Instantiating MLFlowLogger(..., synchronous=True/False) with mlflow<2.8.0 installed (also raises plain ModuleNotFoundError(str(_MLFLOW_AVAILABLE)) if mlflow is missing entirely — this specific message requires mlflow present but old).","commonSituations":"Pinned old mlflow in requirements, or an environment resolver downgraded mlflow; user copies example code that uses synchronous logging.","solutions":["pip install -U 'mlflow>=2.8.0'","Or drop the synchronous kwarg if async behavior is acceptable","Pin mlflow>=2.8.0 in your requirements to prevent downgrade"],"exampleFix":"# before: mlflow 2.5 installed\nlogger = MLFlowLogger(experiment_name='e', synchronous=True)\n# after\npip install 'mlflow>=2.8.0'\nlogger = MLFlowLogger(experiment_name='e', synchronous=True)","handlingStrategy":"validation","validationCode":"import mlflow\nfrom packaging.version import Version\nuse_sync = Version(mlflow.__version__) >= Version(\"2.8.0\")\nlogger = MLFlowLogger(..., synchronous=True if use_sync else None)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pin 'mlflow>=2.8.0' in requirements when using synchronous logging","Fail fast at startup with a version check instead of in logger __init__"],"tags":["mlflow","lightning","logger","version-mismatch","dependency"],"backgroundTag":"library-version-too-old","analyzedSha":"9fed5c27d2a62ff0efd6c3573599921d6ff67c14","analyzedAt":"2026-08-28T11:52:41.083Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}