hf-cloud-python-env-setup
यह क्या करती है
यह स्किल मशीन लर्निंग डिप्लॉयमेंट और AWS स्क्रिप्ट के लिए एक अलग Python वातावरण तैयार करती है। यह उन लोगों के लिए है जिन्हें गलत Python संस्करण या पुरानी लाइब्रेरी से होने वाली गड़बड़ियों का सामना करना पड़ रहा है।
कब इस्तेमाल करें
- ✓जब SageMaker डिप्लॉयमेंट, ट्रेनिंग जॉब या AWS ऑटोमेशन के लिए Python कोड चलना हो।
- ✓जब एजेंट पैकेज इंस्टॉल करने या boto3 कॉल करने वाला हो।
- ✓जब आप एजेंट से वातावरण सेट करने को कहते हैं।
Skill का लिंक
https://github.com/huggingface/skills/blob/main/skills/hf-cloud-python-env-setup/SKILL.mdइसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।
कैसे इस्तेमाल करें
सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।
पेस्ट करने के लिए तैयार मैसेज
Claude Code, Codex या Cursor के लिए: प्रोजेक्ट फ़ोल्डर में चलाएँ और skill इंस्टॉल हो जाएगी।
SKILL.md डाउनलोड करें और अपने एजेंट के skills फ़ोल्डर में रखें।
AI से क्या माँगें: उदाहरण
“एक साफ़ Python वातावरण सेट कीजिए, ताकि मैं SageMaker डिप्लॉयमेंट की स्क्रिप्ट चला सकूँ।”
हर हफ़्ते 5 नई skills, 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
- 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
अक्सर पूछे जाने वाले सवाल
सिस्टम के 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
- अपडेट की गई
- 30/10/2026
कमेंट
- …
इस repository की और skills
hf-cli
11kयह आपके एजेंट को hf कमांड लाइन टूल से Hugging Face पर मॉडल, डेटासेट, Spaces, रिपो और लोकल कैश डाउनलोड करने, अपलोड करने और संभालने में मदद करती है।
hf-cloud-aws-context-discovery
11kयह आपके एजेंट को किसी भी क्लाउड काम से पहले AWS प्रोफ़ाइल, क्षेत्र और खाते का विवरण खोजने में मदद करती है, ताकि वह अंदाज़ा लगाकर खाता न चुने।
hf-cloud-sagemaker-deployment-planner
11kयह आपके एजेंट को मॉडल को Amazon SageMaker पर डिप्लॉय करने की योजना बनाने में मदद करती है, real-time, serverless, async या batch होस्टिंग में से सही विकल्प चुनकर।
hf-cloud-sagemaker-iam-preflight
11kयह आपके एजेंट को डिप्लॉय करने से पहले पक्का करने में मदद करती है कि SageMaker का इस्तेमाल योग्य execution role मौजूद है, बिना जाँचे AWS खाते में नई अनुमतियाँ बनाने की बजाय।
मिलती-जुलती skills
openclaw-update
394kयह आपके एजेंट को चल रहे OpenClaw Gateway को अपडेट करने में मदद करती है, इंस्टॉल के तरीके के अनुसार सही विधि चुनकर और सेशन बनाए रखकर।
diagnose-gateway
394kयह आपके एजेंट को सेटिंग्स, चैनल और पोर्ट जांचकर पता लगाने देती है कि OpenClaw Gateway क्यों फ़ेल हो रहा है, बिना कुछ बदले।
crabbox-apps
394kयह आपके एजेंट को किसी अस्थायी क्लाउड मशीन पर ऐप खोलने और चलाने देती है, फिर उसका व्यू आपके चैट के साइड पैनल में दिखाती है।