unslothai/unsloth · error · HTTPException

S3 dataset loading requires boto3. Install it with: pip inst

Error message

S3 dataset loading requires boto3. Install it with: pip install boto3

What it means

HTTP 501 (not implemented) raised when the request carries an s3_config (and is not a resume) on a host where the optional boto3 dependency is missing. The check runs before credentials are accepted so they are never silently dropped.

Source

Thrown at studio/backend/routes/training.py:1207

                )

        # No in-process ensure_transformers_version(): worker.py activates it before ML imports.

        # A consented latest-transformers install stage-and-swaps .venv_t5_latest mid-spawn.
        from utils.transformers_latest import is_install_in_progress

        if is_install_in_progress():
            raise HTTPException(
                status_code = 409,
                detail = ("A transformers installation is in progress. Retry when it completes."),
            )

        # S3 dataset loading needs the optional boto3 dependency. Reject early so credentials are
        # never accepted and then silently dropped on a host without boto3.
        if request.s3_config is not None and not request.resume_from_checkpoint:
            from core.training.s3_dataset import boto3_available
            if not boto3_available():
                raise HTTPException(
                    status_code = 501,
                    detail = "S3 dataset loading requires boto3. Install it with: pip install boto3",
                )

        if await asyncio.to_thread(backend.is_training_active):
            existing_job_id: Optional[str] = getattr(backend, "current_job_id", "")
            _reject_start_request(
                backend,
                reserved_start_request_id,
                "Training already active",
            )
            return TrainingJobResponse(
                job_id = existing_job_id or "",
                status = "error",
                message = (
                    "Training is already in progress. "
                    "Stop current training before starting a new one."
                ),

View on GitHub (pinned to 203007d190)

Solutions

  1. Install boto3 in the backend environment: pip install boto3
  2. Or point the request at a local/HF dataset instead of S3
  3. For deployments, add boto3 to the image/requirements so the 501 cannot recur

Example fix

# before
POST /training/start {"s3_config": {...}}  # 501

# after (on the backend host)
# pip install boto3
POST /training/start {"s3_config": {...}}
Defensive patterns

Strategy: validation

Validate before calling

# client cannot check boto3 on the server; guard on request shape instead
if payload.get("s3_config") is not None and not payload.get("resume_from_checkpoint"):
    ensure_s3_supported_host()  # ops check: backend host must have boto3 installed

Try / catch

resp = client.post("/training/start", payload)
if resp.status_code == 501 and "boto3" in resp.text:
    raise MissingDependency("install boto3 on the backend host, then retry")

Prevention

When it happens

Trigger: POST /training/start with s3_config set on a host where 'import boto3' fails (core.training.s3_dataset.boto3_available() is False).

Common situations: Minimal install of the studio backend without the S3 extras; running in a container that omitted boto3; assuming S3 support is bundled by default.

Related errors


AI-assisted analysis of unslothai/unsloth@203007d190 (2026-08-15). Data as JSON: /api/errors/fdf4b960a4d3baf8. Report an issue: GitHub.