Official agent skill

Python Environment Setup for SageMaker

by huggingface in huggingface/skills

Sets up an isolated Python environment with a supported interpreter and current boto3 before any SageMaker deployment, training or AWS automation code runs.

OfficialApache-2.0Auto-check passedAI & LLM Engineering

Install Python Environment Setup for SageMaker

skills CLI
$ npx skills add huggingface/skills --skill hf-cloud-python-env-setup -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install huggingface/skills hf-cloud-python-env-setup --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/huggingface/skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/hf-cloud-python-env-setup .claude/skills/hf-cloud-python-env-setup && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
hf-cloud-python-env-setup
GitHub stars
11k
Used in
2 other repos
Token cost
~1.7k tokens
SKILL.md length
739 words
Files
4 (incl. scripts)
Skills in repo
25
Repo updated
First seen
Licence
Apache-2.0

At a glance

Sets up an isolated Python environment with a supported interpreter and current boto3 before any SageMaker deployment, training or AWS automation code runs.

  • Works in 5 steps: Never use the system Python. Always work… → Pin the Python version, not the package… → Install the latest of each package.… → …
  • About to run pip install or call boto3 for a SageMaker job
  • SKILL.md covers Core rules, boto3 vs the SageMaker SDK, How to set up and Verifying, plus 2 more sections
  • Runs Python scripts from its folder; calls python, python3 and uv

What it does

Many SageMaker failures that look like AWS problems are really Python environment problems, such as a wrong interpreter version, broken dependency resolution or a stale SDK. The rules are to never use or install into the system Python, always work in an isolated environment, pin the interpreter to 3.10, 3.11 or 3.12 and avoid 3.13 and later because ML libraries lag on wheels there, and install the latest version of each package. boto3 and awscli are not pinned unless you require a specific version.

Installed versions are checked with importlib.metadata.version, not a module's __version__ attribute, which is inconsistent across packages. The skill ships a requirements.txt and two scripts, setup_env.py and check_versions.py. It also explains that the bundled deployment scripts call boto3 directly, while the SageMaker Python SDK v3 is fine when you or your project prefer it. One caveat is that generative rerankers such as Qwen3-Reranker need the container passed explicitly and need vLLM rather than TEI.

When your agent uses it

  • About to run pip install or call boto3 for a SageMaker job
  • Creating or activating a virtualenv for AWS automation
  • Debugging a SageMaker deployment that fails on dependency or Python version errors
  • Preparing the environment before a SageMaker training job

Example prompts

  • “Set up the Python environment for my SageMaker endpoint deployment.”
  • “My boto3 call fails on a newer API, so check the installed versions and fix it in an isolated environment.”
  • “Create a virtualenv with a supported Python version for this training job.”

Requirements

  • Python 3.10, 3.11 or 3.12 available on the machine

Workflow steps

5 steps, taken from the first numbered list in SKILL.md.

  1. Never use the system Python. Always work inside an isolated environment.
  2. Pin the Python version, not the package versions. Use 3.10, 3.11, or 3.12. Avoid 3.13+ — ML libraries lag on wheel availability and…
  3. Install the latest of each package. Don't defensively pin boto3 or awscli. Newer ones have current API surfaces and security fixes. Only…
  4. Check installed versions correctly. Use importlib.metadata.version("package-name"), never module.version. The latter is inconsistent…
  5. The bundled scripts use boto3 directly. The SageMaker Python SDK is a valid alternative — see "boto3 vs the SageMaker SDK" below.

What it can do on your machine

Read from SKILL.md and the folder at commit ca0325b. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 2 files in scripts/ (Python), which the agent can run.

    Shell commands in SKILL.md call:

    • python
    • python3
    • uv
    • pip
    • aws

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • aws.github.io
    • github.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Python Environment Setup for SageMaker loads about 1.7k tokens when it runs. Until then it costs about 152 tokens; SKILL.md has 739 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~152
When it runs · the whole SKILL.md, loaded when a task matches
~1.7k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from huggingface/skills at commit ca0325b, republished under its Apache-2.0 licence (© huggingface). 739 words, ~1,674 tokens.

Download SKILL.mdSave it as .claude/skills/hf-cloud-python-env-setup/SKILL.md (or your agent's skills folder). This skill also uses 3 other files; get the full folder from GitHub.
name
hf-cloud-python-env-setup
description
Set up an isolated Python environment for SageMaker / AWS work, with the right Python version and current boto3. Use this skill whenever Python code will be executed for a SageMaker deployment, training job, or any AWS automation — including when about to run `pip install`, when about to invoke `boto3`, when creating or activating a virtualenv, or when the user asks to "set up the environment". Never use system Python and never `pip install` into it. Always isolate. This skill prevents the most common failure modes: wrong Python version, dependency conflicts, and stale SDKs.

Python Environment Setup for SageMaker

Most SageMaker deployment failures that look like AWS problems are actually Python environment problems: wrong Python version, broken dependency resolution, stale SDK that doesn't know about a current API. This skill makes env setup boring and correct.

Core rules

  1. Never use the system Python. Always work inside an isolated environment.
  2. Pin the Python version, not the package versions. Use 3.10, 3.11, or 3.12. Avoid 3.13+ — ML libraries lag on wheel availability and dependency resolution breaks in confusing ways.
  3. Install the latest of each package. Don't defensively pin boto3 or awscli. Newer ones have current API surfaces and security fixes. Only pin if the user explicitly requires a specific version.
  4. Check installed versions correctly. Use importlib.metadata.version("package-name"), never module.__version__. The latter is inconsistent across packages.
  5. The bundled scripts use boto3 directly. The SageMaker Python SDK is a valid alternative — see "boto3 vs the SageMaker SDK" below.

boto3 vs the SageMaker SDK

The bundled deploy scripts (deploy.py, deploy_async.py, teardown.py) use boto3 directly and read image URIs from AWS's published Deep Learning Containers catalog. That fits this workflow's explicit-stages design — each skill produces a concrete value (region, role ARN, image URI) that the next one consumes — and boto3 is the stable underlying API client.

The SageMaker Python SDK (v3) is fine to use when the user prefers it or their project already does. Since PR #5960 (June 2026), ModelBuilder auto-routes HuggingFace models to the current containers (text-generation → HuggingFace vLLM, multimodal → vLLM-Omni, embeddings → TEI). Don't avoid the SDK over stale-image or wrong-container concerns — that routing is fixed.

Two specific SDK cases that still need care:

  • Generative rerankers: the SDK routes the text-ranking task to TEI unconditionally, which is wrong for causal-LM rerankers like Qwen3-Reranker — those need vLLM (see hf-cloud-serving-image-selection). Pass the container explicitly for these models.
  • SSO assumed-role credentials: v3 has had credential-resolution regressions in ModelTrainer / FrameworkProcessor under SSO profiles. If SDK calls fail with credential errors while aws sts get-caller-identity succeeds in the same shell, suspect this rather than your AWS config.

If you use the SDK, install it into the isolated env like everything else (.venv/bin/python -m pip install sagemaker). The bundled scripts don't require it.

How to set up

The fastest path is the bundled script — it's Python, so it runs the same on Windows, macOS, and Linux:

bash
python3 scripts/setup_env.py        # macOS / Linux
python  scripts/setup_env.py        # Windows (PowerShell / cmd)

This script detects uv and uses it if available (faster), falls back to the stdlib venv module, creates .venv/ with Python 3.12 (override: python3 setup_env.py .venv 3.11), refuses unsupported Python versions, installs from the bundled requirements.txt, and is idempotent. It also prints the correct interpreter path for the host OS (see below).

Manual equivalent:

bash
# Preferred: uv
uv venv --python 3.12 .venv
uv pip install --python .venv/bin/python --upgrade boto3 awscli   # Windows: .venv\Scripts\python.exe

# Fallback: stdlib venv
python3.12 -m venv .venv
.venv/bin/python -m pip install --upgrade pip boto3 awscli

After setup, invoke the env's Python explicitly rather than activating the venv. The interpreter path differs by platform:

bash
.venv/bin/python deploy.py            # macOS / Linux
.venv\Scripts\python.exe deploy.py    # Windows

This works the same in scripts, interactive shells, and agent tool calls. The rest of this skill writes .venv/bin/python for brevity — on Windows substitute .venv\Scripts\python.exe.

Show full SKILL.md (256 more words)Show less

Verifying

bash
.venv/bin/python scripts/check_versions.py

Prints versions of boto3, botocore, awscli. Uses importlib.metadata.version() so it works on every package, including ones without __version__. Pass arbitrary names: ... check_versions.py transformers huggingface_hub.

Deployment-specific extras

Default requirements.txt covers SageMaker orchestration. Some deployments need extras (huggingface_hub for model inspection, transformers for tokenizer validation). Add these to a deployment-specific requirements file in the project, install with the env's Python, don't pin unless there's a reason.

Common pitfalls

Mysterious pip install resolution errors Almost always Python 3.13+ trying to install packages without wheels yet, or installing into a polluted system Python. Recreate at 3.12: delete .venv and re-run python3 setup_env.py .venv 3.12 (the script recreates the env when the version doesn't match, so you can also just re-run it).

pip install succeeded but the script says "module not found" You installed into a different interpreter than the one running the script. Always invoke Python explicitly: .venv/bin/python -m pip install ... and .venv/bin/python deploy.py.

Inline python -c "..." one-liners fail in PowerShell PowerShell's quoting rules mangle nested/escaped quotes in inline Python. Don't debug the quoting — write the snippet to a small .py file and run that. (All bundled helpers are files for exactly this reason.)

boto3 call fails with "unknown parameter" Your boto3 is older than the API surface. Upgrade with .venv/bin/python -m pip install --upgrade boto3. Don't downgrade the script to match an old version.

sagemaker (the SDK) installed but the bundled scripts fail The bundled scripts don't use the SDK — they only need boto3/awscli from requirements.txt. Installing sagemaker alongside is harmless, but it doesn't replace the requirements install.

© huggingface, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 3 other files (scripts) in skills/hf-cloud-python-env-setup of huggingface/skills.

  • SKILL.md
  • requirements.txt
  • scripts/check_versions.py
  • scripts/setup_env.py

Open the folder on GitHubat commit ca0325b

Used in 2 other repositories

We found 2 copies of this SKILL.md (exact, near-identical or edited) in other folders, from 2 other GitHub owners. This page covers the copy in huggingface/skills, which our catalogue first saw on October 7, 2026.

Compare with similar skills

Python Environment Setup for SageMaker next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Python Environment Setup for SageMaker compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Python Environment Setup for SageMaker this skillhuggingface/skills11k2 repos~1.7kAutomated safety check: PassApache-2.0
AWS AI MLaws/agent-toolkit-for-aws2.8k—~1.7kAutomated safety check: PassApache-2.0
Hf Cloud Serving Image Selectionwaybarrios/opencode-power-pack533—~4.3kAutomated safety check: PassApache-2.0
Hyperpod Version Checkerawslabs/agent-plugins9121 repos~910Automated safety check: PassApache-2.0
Model Deploymentawslabs/agent-plugins9121 repos~1.5kAutomated safety check: PassApache-2.0
AWS Cdk Developmentzxkane/aws-skills3672 repos~2.5kAutomated safety check: PassMIT

Similar skills

  • AWS AI ML

    aws/agent-toolkit-for-aws

    Official

    Selects, deploys, and customizes AI models on Amazon SageMaker.

    2.8k GitHub stars~1.7k tokensUpdated today
    AI & LLM EngineeringAuto-check passed
  • Hf Cloud Serving Image Selection

    waybarrios/opencode-power-pack

    Select and verify the current region-specific serving container URI for a SageMaker model deployment.

    533 GitHub stars~4.3k tokensUpdated yesterday
    AI & LLM EngineeringAuto-check passed
  • Hyperpod Version Checker

    awslabs/agent-plugins

    Official

    Check and compare software component versions on SageMaker HyperPod cluster nodes - NVIDIA drivers, CUDA toolkit, cuDNN, NCCL, EFA, AWS OFI NCCL, GDRCopy, MPI, Neuron SDK (Trainium/Inferentia)…

    912 GitHub starsUsed in 1 repo~910 tokens
    AI & LLM EngineeringAuto-check passed
  • Model Deployment

    awslabs/agent-plugins

    Official

    Generates code that deploys fine-tuned models from SageMaker Serverless Model Customization to SageMaker endpoints or Bedrock.

    912 GitHub starsUsed in 1 repo~1.5k tokens
    Backend & APIsAuto-check passed
  • AWS Cdk Development

    zxkane/aws-skills

    AWS Cloud Development Kit (CDK) expert for building cloud infrastructure with TypeScript/Python.

    367 GitHub starsUsed in 2 repos~2.5k tokens
    DevOps & CloudAuto-check passed
  • Bumps the pinned Quarto version across the RStudio repository, mirrors the release to the rstudio-buildtools S3 bucket, verifies it and opens a PR, on macOS and Linux.

    5.1k GitHub stars~2.8k tokensUpdated today
    DevOps & CloudAuto-check passed

More from huggingface/skills

All 25 skills in this repo
  • Official

    Finds or validates a usable SageMaker execution role before deploying or training, so scripts do not try to create IAM roles they lack permission to create.

    11k GitHub starsUsed in 1 repo~1.8k tokens
    Auto-check passed
  • Official

    Chooses the right serving container and current image URI for deploying a Hugging Face model to a SageMaker endpoint, preferring Hugging Face images over generic ones.

    11k GitHub starsUsed in 1 repo~4.6k tokens
    Auto-check passed
  • Hugging Face LLM Trainer

    huggingface/skills

    Official

    Trains or fine-tunes language and vision models with TRL or Unsloth on Hugging Face Jobs cloud GPUs, then converts the results to GGUF.

    11k GitHub starsUsed in 3 repos~7.2k tokens
    Auto-check passed
  • Official

    Routes a sentence-transformers training task to the right model type and required reference docs and example scripts, covering bi-encoders, rerankers, sparse and multi-vector models.

    11k GitHub starsUsed in 1 repo~2.6k tokens
    Auto-check passed
  • Official

    Runs evaluations of Hugging Face Hub models on local hardware with inspect-ai or lighteval, and helps choose between vLLM, Transformers and accelerate backends.

    11k GitHub starsUsed in 2 repos~1.6k tokens
    Auto-check passed
  • Official

    Indexes research papers on the Hugging Face Hub from arXiv, links them to models and datasets, claims authorship and generates markdown research articles from templates.

    11k GitHub starsUsed in 5 repos~4.2k tokens
    Auto-check passed

Questions about Python Environment Setup for SageMaker

What does Python Environment Setup for SageMaker do?

Sets up an isolated Python environment with a supported interpreter and current boto3 before any SageMaker deployment, training or AWS automation code runs. Many SageMaker failures that look like AWS problems are really Python environment problems, such as a wrong interpreter version, broken dependency resolution or a stale SDK.13 and later because ML libraries lag on wheels there, and install the latest version of each package.

When should I use Python Environment Setup for SageMaker?

Python Environment Setup for SageMaker fits situations like: about to run pip install or call boto3 for a SageMaker job; creating or activating a virtualenv for AWS automation; debugging a SageMaker deployment that fails on dependency or Python version errors; preparing the environment before a SageMaker training job.

How do I install Python Environment Setup for SageMaker in Claude Code?

Run `npx skills add huggingface/skills --skill hf-cloud-python-env-setup -a claude-code`. Or copy the skill folder (skills/hf-cloud-python-env-setup in huggingface/skills) into .claude/skills/hf-cloud-python-env-setup in your project. Claude Code loads it when a task matches its description.

How do I install Python Environment Setup for SageMaker in Codex?

Run `npx skills add huggingface/skills --skill hf-cloud-python-env-setup -a codex`. Or copy the skill folder (skills/hf-cloud-python-env-setup in huggingface/skills) into .agents/skills/hf-cloud-python-env-setup in your project. Codex loads it when a task matches its description.

Can I use Python Environment Setup for SageMaker in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add huggingface/skills --skill hf-cloud-python-env-setup -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/hf-cloud-python-env-setup, .gemini/skills/hf-cloud-python-env-setup, .github/skills/hf-cloud-python-env-setup and .opencode/skills/hf-cloud-python-env-setup in your project.

What does Python Environment Setup for SageMaker need to run?

Going by SKILL.md and its folder, Python Environment Setup for SageMaker needs Python for the scripts in its folder and the command-line tools its instructions call (python, python3, uv, pip and aws). Our summary lists: Python 3.10, 3.11 or 3.12 available on the machine.

Does Python Environment Setup for SageMaker access the network?

SKILL.md names 2 domains. As links in the text: aws.github.io and github.com. This is read from the text; nothing was executed.

Is Python Environment Setup for SageMaker safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Python Environment Setup for SageMaker use?

Python Environment Setup for SageMaker is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Python Environment Setup for SageMaker use?

About 1.7k tokens (SKILL.md is roughly 6.7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Python Environment Setup for SageMaker?

Skills that share tags, products or a category with Python Environment Setup for SageMaker: AWS AI ML (aws/agent-toolkit-for-aws, 2.8k stars), Hf Cloud Serving Image Selection (waybarrios/opencode-power-pack, 533 stars), Hyperpod Version Checker (awslabs/agent-plugins, 912 stars) and Model Deployment (awslabs/agent-plugins, 912 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Python Environment Setup for SageMaker?

huggingface (a GitHub organization, an official publisher) maintains it in huggingface/skills, which has 11,142 GitHub stars. The repository holds 25 skills in this directory. The repository was last updated on October 1, 2026.

Source: huggingface/skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.