본문으로 건너뛰기
cccskills
무료GitHub에 공개

hf-cloud-python-env-setup

Prepare an isolated Python environment for SageMaker deployments and AWS automation. The skill selects a supported Python version, installs current AWS packages, and checks versions so installation and execution use the same environment.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

원문원문 설명 보기

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.

연동 도구AWSHugging Face
설치 방법 보기

이럴 때 유용합니다

  • Prepare a Python environment for SageMaker deployment
  • Separate AWS automation dependencies from system Python
  • Check installed AWS package versions
  • Investigate installation errors or missing modules

포함된 파일(4)

  • SKILL.md6.6 KB
  • requirements.txt796 B
  • scripts/check_versions.py740 B
  • scripts/setup_env.py4.9 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

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:

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:

# 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:

.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.

Verifying

.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.

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

hf-cli

무료

Manage Hugging Face Hub through the hf command line tool. Download and upload models or datasets, organize cloud storage, manage authentication and local caches, run scheduled jobs, and deploy or maintain model inference services.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Download or publish models and datasets
  • Sync training checkpoints to cloud storage
  • Inspect and clean the local cache
huggingface/skills1.1만2026년 10월 9일 업데이트

Check the AWS profile, region, account ID, and caller identity before starting AWS work. Read local configuration and validate credentials, then flag missing settings, expired access, or possible IAM restrictions associated with SSO authentication.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Check the AWS account and region before deployment
  • Identify the active profile when none was specified
  • Detect expired credentials or missing configuration
huggingface/skills1.1만2026년 10월 9일 업데이트

Plan how to serve a model on Amazon SageMaker AI. The skill uses model type, traffic, response time, and cost constraints to recommend a deployment route, check instance quotas, and coordinate specialized setup and deployment skills.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Plan AWS hosting for a language model
  • Choose a serving route for an embedding model
  • Plan asynchronous inference for image generation
huggingface/skills1.1만2026년 10월 9일 업데이트

Prepare SageMaker deployments and training by finding existing execution roles, checking trust settings, and reviewing required permissions. Guides role creation only when necessary and identifies permission issues that require an AWS administrator.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Check execution roles before deploying a SageMaker endpoint
  • Find an existing role when no ARN is provided
  • Investigate IAM AccessDenied errors
huggingface/skills1.1만2026년 10월 9일 업데이트

Deploy SageMaker endpoints, the services that answer model requests, with automatic capacity scaling, CloudWatch alarms, and resource tags. Supports real-time and asynchronous inference, scaling down to zero instances, deployment checks, and resource cleanup.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Deploying a real-time model endpoint
  • Scaling a sparse workload down to zero instances
  • Running long inference jobs asynchronously
huggingface/skills1.1만2026년 10월 9일 업데이트

Choose a serving container for models deployed on SageMaker. Match the model type to a compatible image, retrieve its address from the AWS catalog, and check regional availability, CPU or GPU variants, and required host settings.

한국어 요약은 준비 중입니다. 영어 요약을 표시하고 있습니다.

  • Choose a container for an LLM deployment
  • Select images for embeddings and rerankers
  • Check regional image addresses and GPU compatibility
huggingface/skills1.1만2026년 10월 9일 업데이트

huggingface의 스킬 모두 보기

이 스킬의 문제 신고