{"record":{"id":"9029bae471ba89f5","repo":"unslothai/unsloth","slug":"a-transformers-installation-is-in-progress-retry-9029ba","errorCode":null,"errorMessage":"A transformers installation is in progress. Retry when it completes.","messagePattern":"A transformers installation is in progress\\. Retry when it completes\\.","errorType":"http","errorClass":"HTTPException","httpStatus":409,"severity":"warning","filePath":"studio/backend/routes/training.py","lineNumber":1197,"sourceCode":"            if (\n                other_inference_request_count(current_request_counted = False) > 0\n                or _background_video_generation_active()\n            ):\n                raise HTTPException(\n                    status_code = 409,\n                    detail = (\n                        \"Cannot start training over the API while an inference request is in \"\n                        \"progress. Wait for it to finish, or start training from the Unsloth UI.\"\n                    ),\n                )\n\n        # No in-process ensure_transformers_version(): worker.py activates it before ML imports.\n\n        # A consented latest-transformers install stage-and-swaps .venv_t5_latest mid-spawn.\n        from utils.transformers_latest import is_install_in_progress\n\n        if is_install_in_progress():\n            raise HTTPException(\n                status_code = 409,\n                detail = (\"A transformers installation is in progress. Retry when it completes.\"),\n            )\n\n        # S3 dataset loading needs the optional boto3 dependency. Reject early so credentials are\n        # never accepted and then silently dropped on a host without boto3.\n        if request.s3_config is not None and not request.resume_from_checkpoint:\n            from core.training.s3_dataset import boto3_available\n            if not boto3_available():\n                raise HTTPException(\n                    status_code = 501,\n                    detail = \"S3 dataset loading requires boto3. Install it with: pip install boto3\",\n                )\n\n        if await asyncio.to_thread(backend.is_training_active):\n            existing_job_id: Optional[str] = getattr(backend, \"current_job_id\", \"\")\n            _reject_start_request(\n                backend,","sourceCodeStart":1179,"sourceCodeEnd":1215,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/routes/training.py#L1179-L1215","documentation":"HTTP 409 raised when utils.transformers_latest.is_install_in_progress() reports an active stage-and-swap install of the latest-transformers venv (.venv_t5_latest). Starting training mid-swap could run against a half-replaced environment, so the route refuses until the install completes.","triggerScenarios":"POST /training/start while a consented 'latest transformers' installation is staging or swapping the alternate virtualenv.","commonSituations":"User clicked install-latest-transformers in the UI and immediately started training; an automated env upgrade racing a scheduled training job.","solutions":["Wait for the transformers installation to complete (watch install status in the UI/logs), then retry the training start","If the install appears stuck, inspect the install log/process and resolve it before retrying","Do not run the latest-transformers install concurrently with training starts"],"exampleFix":"// before\nresp = client.post(\"/training/start\", payload)  # 409 install in progress\n\n// after\n# poll until install completes, then retry\nwhile install_status_endpoint().in_progress:\n    time.sleep(10)\nresp = client.post(\"/training/start\", payload)","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"resp = client.post(\"/training/start\", payload)\nif resp.status_code == 409 and \"transformers installation is in progress\" in resp.text:\n    wait_for_install_completion()  # poll install status or logs\n    resp = client.post(\"/training/start\", payload)","preventionTips":["Never trigger a latest-transformers install and a training start at the same time","Queue training starts behind install completion in automation scripts","Treat this 409 as transient: retry after completion, do not reconfigure"],"tags":["training","transformers","install","environment","http-409","transient"],"backgroundTag":null,"analyzedSha":"203007d19051dcd2ae33876786d117c99f6b0368","analyzedAt":"2026-08-15T02:48:39.846Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}