본문으로 건너뛰기
Skillpedia
배포 및 클라우드 (DevOps)11k · #11767

hf-cloud-python-env-setup

하는 일

이 스킬은 머신러닝 배포와 AWS 스크립트를 위한 독립된 Python 환경을 준비합니다. 잘못된 Python 버전이나 오래된 라이브러리로 생기는 오류를 겪는 사람들을 위한 스킬입니다.

사용하는 경우

  • ✓SageMaker 배포, 학습 작업 또는 AWS 자동화를 위해 Python 코드를 실행해야 할 때.
  • ✓에이전트가 패키지를 설치하거나 boto3를 호출하려고 할 때.
  • ✓에이전트에게 환경을 설정해 달라고 요청할 때.

스킬 링크

https://github.com/huggingface/skills/blob/main/skills/hf-cloud-python-env-setup/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/huggingface/skills/blob/main/skills/hf-cloud-python-env-setup/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“SageMaker 배포 스크립트를 실행할 수 있도록 깔끔한 Python 환경을 설정해 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

AI는 3.10에서 3.12 사이의 지원되는 Python 버전으로 별도의 환경을 만들고, 필요한 패키지의 최신 버전을 설치합니다. 그다음 설치된 버전을 신뢰할 수 있는 방식으로 확인합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

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 (`hu

자주 묻는 질문

시스템 Python을 쓰지 않는 이유는 무엇인가요?

스킬은 항상 독립된 환경에서 작업하므로, 컴퓨터의 다른 소프트웨어가 간섭하지 않습니다.

패키지 버전을 고정하나요?

아닙니다. 특정 버전을 요청하지 않는 한 최신 패키지 버전을 설치합니다.

가장 최신 Python 버전은 왜 피하나요?

머신러닝 라이브러리는 가장 새로운 Python 버전을 따라잡는 데 시간이 걸려, 설치 문제가 생기기 쉽기 때문입니다.

상세 정보

작성자의 원본 설명

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.

repo: huggingface/skills

인기도

GitHub 스타
11k
순위
#11767
라이선스
Apache-2.0
업데이트
2026. 10. 30.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬