hf-cloud-python-env-setup
Fungsinya
Skill ini menyiapkan lingkungan Python yang terisolasi untuk deployment machine learning dan skrip AWS. Skill ini ditujukan untuk orang yang mengalami error akibat versi Python yang salah atau pustaka yang sudah usang.
Kapan dipakai
- βSaat kode Python akan dijalankan untuk deployment SageMaker, tugas pelatihan atau otomatisasi AWS.
- βSaat agent akan memasang paket atau memanggil boto3.
- βSaat Anda meminta agent menyiapkan lingkungan.
Link skill
https://github.com/huggingface/skills/blob/main/skills/hf-cloud-python-env-setup/SKILL.mdSalin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.
Cara pakai
Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.
Pesan siap tempel
Untuk Claude Code, Codex, atau Cursor: jalankan di folder proyek, lalu skill langsung terpasang.
Unduh SKILL.md lalu taruh di folder skill agen Anda.
Contoh permintaan ke AI
βSiapkan lingkungan Python yang bersih agar saya bisa menjalankan skrip deployment SageMaker.β
5 skill baru setiap minggu. 1 menit baca.
Cara kerjanya
AI membuat lingkungan terpisah dengan versi Python yang didukung, dari 3.10 sampai 3.12, dan memasang versi terbaru dari paket yang dibutuhkan. Setelah itu AI memeriksa versi yang terpasang dengan cara yang andal.
Konten teknis (SKILL.md asli)
Teks asli dari pembuat, dalam bahasa Inggris, langsung dari 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
- Never use the system Python. Always work inside an isolated environment.
- 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.
- Install the latest of each package. Don't defensively pin
boto3orawscli. Newer ones have current API surfaces and security fixes. Only pin if the user explicitly requires a specific version. - Check installed versions correctly. Use
importlib.metadata.version("package-name"), nevermodule.__version__. The latter is inconsistent across packages. - The bundled scripts use
boto3directly. 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-rankingtask to TEI unconditionally, which is wrong for causal-LM rerankers like Qwen3-Reranker β those need vLLM (seehf-cloud-serving-image-selection). Pass the container explicitly for these models. - SSO assumed-role credentials: v3 has had credential-resolution regressions in
ModelTrainer/FrameworkProcessorunder SSO profiles. If SDK calls fail with credential errors whileaws sts get-caller-identitysucceeds 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
Pertanyaan umum
Mengapa tidak memakai Python sistem?
Skill selalu bekerja di lingkungan yang terisolasi, sehingga perangkat lunak lain di komputer Anda tidak mengganggu.
Apakah versi paket akan dikunci?
Tidak. Skill memasang versi paket terbaru kecuali Anda meminta versi tertentu.
Mengapa versi Python terbaru sebaiknya dihindari?
Pustaka machine learning bisa tertinggal dari versi Python terbaru, yang menimbulkan masalah pemasangan yang membingungkan.
Detail
Deskripsi asli dari pembuat
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
Popularitas
- Bintang GitHub
- 11k
- Peringkat
- #11767
- Lisensi
- Apache-2.0
- Diperbarui
- 30/10/2026
Komentar
- β¦
Skill lain dari repositori ini
hf-cli
11kMembantu agent Anda memakai alat baris perintah Hugging Face untuk mengunduh, mengunggah dan mengelola model, dataset, Space, repositori serta cache lokal.
hf-cloud-aws-context-discovery
11kMembantu agent Anda menemukan profil, wilayah dan detail akun AWS Anda sebelum pekerjaan cloud apa pun, sehingga agent tidak menebak akun mana yang harus dipakai.
hf-cloud-sagemaker-deployment-planner
11kMembantu agent Anda merencanakan cara men-deploy model ke Amazon SageMaker, memilih hosting real-time, serverless, async atau batch dengan default yang masuk akal.
hf-cloud-sagemaker-iam-preflight
11kMembantu agent Anda memastikan ada peran eksekusi SageMaker yang bisa dipakai sebelum deployment, dan tidak membuat izin baru di akun AWS Anda tanpa memeriksanya.
Skill serupa
openclaw-update
394kMembantu agent Anda memperbarui OpenClaw Gateway yang sudah ada, dengan memilih metode pembaruan yang sesuai cara pemasangannya dan menjaga sesi Anda tetap berjalan.
diagnose-gateway
394kMembantu agent Anda mencari tahu mengapa OpenClaw Gateway gagal dengan memeriksa pengaturan, channel, dan port tanpa mengubah apa pun.
crabbox-apps
394kMembantu agent Anda membuka dan menjalankan aplikasi di mesin cloud sementara, lalu menampilkan tampilannya di panel samping chat Anda.