[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7DH48DF3EZSQ8JYW7X4F6NS":3,"skill-same:01M7DH48DF3EZSQ8JYW7X4F6NS":60},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":23,"commitSha":24,"skillDirectory":25,"forksCount":13,"repositoryHtmlUrl":26,"repositoryHomepageUrl":27,"ownerHtmlUrl":28,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":29,"install":30,"resources":43},"01M7DH48DF3EZSQ8JYW7X4F6NS","hf-cloud-python-env-setup",null,"Set up an isolated Python environment for SageMaker \u002F 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.","ak2dev\u002Fagentguard","ak2dev","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F233005497?v=4","01M7DGWK3E3XCC276C6YRFSN05","01M7DGWK4J2A9WQ44CS5CRP4R6",0,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fak2dev\u002Fagentguard\u002Fblob\u002Fmain\u002Fbench\u002Fcorpus\u002Fbenign\u002Freal-hf-hf-cloud-python-env-setup\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: hf-cloud-python-env-setup\ndescription: 'Set up an isolated Python environment for SageMaker \u002F 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.'\n---\n\n# Python Environment Setup for SageMaker\n\nMost 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.\n\n## Core rules\n\n1. **Never use the system Python.** Always work inside an isolated environment.\n2. **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.\n3. **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.\n4. **Check installed versions correctly.** Use `importlib.metadata.version(\"package-name\")`, never `module.__version__`. The latter is inconsistent across packages.\n5. **The bundled scripts use `boto3` directly.** The SageMaker Python SDK is a valid alternative — see \"boto3 vs the SageMaker SDK\" below.\n\n## boto3 vs the SageMaker SDK\n\nThe 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](https:\u002F\u002Faws.github.io\u002Fdeep-learning-containers\u002Freference\u002Favailable_images\u002F). 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.\n\nThe SageMaker Python SDK (v3) is fine to use when the user prefers it or their project already does. Since [PR #5960](https:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Fpull\u002F5960) (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.\n\nTwo specific SDK cases that still need care:\n\n- **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.\n- **SSO assumed-role credentials**: v3 has had credential-resolution regressions in `ModelTrainer` \u002F `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.\n\nIf you use the SDK, install it into the isolated env like everything else (`.venv\u002Fbin\u002Fpython -m pip install sagemaker`). The bundled scripts don't require it.\n\n## How to set up\n\nThe fastest path is the bundled script — it's Python, so it runs the same on Windows, macOS, and Linux:\n\n```bash\npython3 scripts\u002Fsetup_env.py        # macOS \u002F Linux\npython  scripts\u002Fsetup_env.py        # Windows (PowerShell \u002F cmd)\n```\n\nThis script detects `uv` and uses it if available (faster), falls back to the stdlib `venv` module, creates `.venv\u002F` 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).\n\nManual equivalent:\n\n```bash\n# Preferred: uv\nuv venv --python 3.12 .venv\nuv pip install --python .venv\u002Fbin\u002Fpython --upgrade boto3 awscli   # Windows: .venv\\Scripts\\python.exe\n\n# Fallback: stdlib venv\npython3.12 -m venv .venv\n.venv\u002Fbin\u002Fpython -m pip install --upgrade pip boto3 awscli\n```\n\nAfter setup, **invoke the env's Python explicitly** rather than activating the venv. The interpreter path differs by platform:\n\n```bash\n.venv\u002Fbin\u002Fpython deploy.py            # macOS \u002F Linux\n.venv\\Scripts\\python.exe deploy.py    # Windows\n```\n\nThis works the same in scripts, interactive shells, and agent tool calls. The rest of this skill writes `.venv\u002Fbin\u002Fpython` for brevity — on Windows substitute `.venv\\Scripts\\python.exe`.\n\n## Verifying\n\n```bash\n.venv\u002Fbin\u002Fpython scripts\u002Fcheck_versions.py\n```\n\nPrints 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`.\n\n## Deployment-specific extras\n\nDefault `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.\n\n## Common pitfalls\n\n**Mysterious `pip install` resolution errors**\nAlmost 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).\n\n**`pip install` succeeded but the script says \"module not found\"**\nYou installed into a different interpreter than the one running the script. Always invoke Python explicitly: `.venv\u002Fbin\u002Fpython -m pip install ...` and `.venv\u002Fbin\u002Fpython deploy.py`.\n\n**Inline `python -c \"...\"` one-liners fail in PowerShell**\nPowerShell's quoting rules mangle nested\u002Fescaped 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.)\n\n**boto3 call fails with \"unknown parameter\"**\nYour boto3 is older than the API surface. Upgrade with `.venv\u002Fbin\u002Fpython -m pip install --upgrade boto3`. Don't downgrade the script to match an old version.\n\n**`sagemaker` (the SDK) installed but the bundled scripts fail**\nThe bundled scripts don't use the SDK — they only need `boto3`\u002F`awscli` from `requirements.txt`. Installing `sagemaker` alongside is harmless, but it doesn't replace the requirements install.\n","# Python Environment Setup for SageMaker\n\nMost 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.\n\n## Core rules\n\n1. **Never use the system Python.** Always work inside an isolated environment.\n2. **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.\n3. **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.\n4. **Check installed versions correctly.** Use `importlib.metadata.version(\"package-name\")`, never `module.__version__`. The latter is inconsistent across packages.\n5. **The bundled scripts use `boto3` directly.** The SageMaker Python SDK is a valid alternative — see \"boto3 vs the SageMaker SDK\" below.\n\n## boto3 vs the SageMaker SDK\n\nThe 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](https:\u002F\u002Faws.github.io\u002Fdeep-learning-containers\u002Freference\u002Favailable_images\u002F). 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.\n\nThe SageMaker Python SDK (v3) is fine to use when the user prefers it or their project already does. Since [PR #5960](https:\u002F\u002Fgithub.com\u002Faws\u002Fsagemaker-python-sdk\u002Fpull\u002F5960) (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.\n\nTwo specific SDK cases that still need care:\n\n- **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.\n- **SSO assumed-role credentials**: v3 has had credential-resolution regressions in `ModelTrainer` \u002F `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.\n\nIf you use the SDK, install it into the isolated env like everything else (`.venv\u002Fbin\u002Fpython -m pip install sagemaker`). The bundled scripts don't require it.\n\n## How to set up\n\nThe fastest path is the bundled script — it's Python, so it runs the same on Windows, macOS, and Linux:\n\n```bash\npython3 scripts\u002Fsetup_env.py        # macOS \u002F Linux\npython  scripts\u002Fsetup_env.py        # Windows (PowerShell \u002F cmd)\n```\n\nThis script detects `uv` and uses it if available (faster), falls back to the stdlib `venv` module, creates `.venv\u002F` 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).\n\nManual equivalent:\n\n```bash\n# Preferred: uv\nuv venv --python 3.12 .venv\nuv pip install --python .venv\u002Fbin\u002Fpython --upgrade boto3 awscli   # Windows: .venv\\Scripts\\python.exe\n\n# Fallback: stdlib venv\npython3.12 -m venv .venv\n.venv\u002Fbin\u002Fpython -m pip install --upgrade pip boto3 awscli\n```\n\nAfter setup, **invoke the env's Python explicitly** rather than activating the venv. The interpreter path differs by platform:\n\n```bash\n.venv\u002Fbin\u002Fpython deploy.py            # macOS \u002F Linux\n.venv\\Scripts\\python.exe deploy.py    # Windows\n```\n\nThis works the same in scripts, interactive shells, and agent tool calls. The rest of this skill writes `.venv\u002Fbin\u002Fpython` for brevity — on Windows substitute `.venv\\Scripts\\python.exe`.\n\n## Verifying\n\n```bash\n.venv\u002Fbin\u002Fpython scripts\u002Fcheck_versions.py\n```\n\nPrints 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`.\n\n## Deployment-specific extras\n\nDefault `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.\n\n## Common pitfalls\n\n**Mysterious `pip install` resolution errors**\nAlmost 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).\n\n**`pip install` succeeded but the script says \"module not found\"**\nYou installed into a different interpreter than the one running the script. Always invoke Python explicitly: `.venv\u002Fbin\u002Fpython -m pip install ...` and `.venv\u002Fbin\u002Fpython deploy.py`.\n\n**Inline `python -c \"...\"` one-liners fail in PowerShell**\nPowerShell's quoting rules mangle nested\u002Fescaped 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.)\n\n**boto3 call fails with \"unknown parameter\"**\nYour boto3 is older than the API surface. Upgrade with `.venv\u002Fbin\u002Fpython -m pip install --upgrade boto3`. Don't downgrade the script to match an old version.\n\n**`sagemaker` (the SDK) installed but the bundled scripts fail**\nThe bundled scripts don't use the SDK — they only need `boto3`\u002F`awscli` from `requirements.txt`. Installing `sagemaker` alongside is harmless, but it doesn't replace the requirements install.\n",{"name":5,"description":7},"main","634c25395a24b98cd6125453ad4abb65517bcabb","bench\u002Fcorpus\u002Fbenign\u002Freal-hf-hf-cloud-python-env-setup","https:\u002F\u002Fgithub.com\u002Fak2dev\u002Fagentguard","https:\u002F\u002Fsite-bionic8.vercel.app","https:\u002F\u002Fgithub.com\u002Fak2dev","2026-11-11 02:37:06",{"source":8,"skillName":5,"commands":31,"prompt":41,"zipAvailable":42},[32,35,38],{"tool":33,"command":34},"npx","npx skills add ak2dev\u002Fagentguard --skill hf-cloud-python-env-setup",{"tool":36,"command":37},"bunx","bunx skills add ak2dev\u002Fagentguard --skill hf-cloud-python-env-setup",{"tool":39,"command":40},"pnpm","pnpm dlx skills add ak2dev\u002Fagentguard --skill hf-cloud-python-env-setup","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fak2dev\u002Fagentguard\u002Fblob\u002Fmain\u002Fbench\u002Fcorpus\u002Fbenign\u002Freal-hf-hf-cloud-python-env-setup\u002FSKILL.md",true,[44,50,56],{"path":45,"resourceType":46,"resourceTypeDesc":47,"sizeBytes":48,"sourceHtmlUrl":49},"requirements.txt","REFERENCE","参考文档",796,"https:\u002F\u002Fgithub.com\u002Fak2dev\u002Fagentguard\u002Fblob\u002Fmain\u002Fbench\u002Fcorpus\u002Fbenign\u002Freal-hf-hf-cloud-python-env-setup\u002Frequirements.txt",{"path":51,"resourceType":52,"resourceTypeDesc":53,"sizeBytes":54,"sourceHtmlUrl":55},"scripts\u002Fcheck_versions.py","SCRIPT","脚本",740,"https:\u002F\u002Fgithub.com\u002Fak2dev\u002Fagentguard\u002Fblob\u002Fmain\u002Fbench\u002Fcorpus\u002Fbenign\u002Freal-hf-hf-cloud-python-env-setup\u002Fscripts\u002Fcheck_versions.py",{"path":57,"resourceType":52,"resourceTypeDesc":53,"sizeBytes":58,"sourceHtmlUrl":59},"scripts\u002Fsetup_env.py",5035,"https:\u002F\u002Fgithub.com\u002Fak2dev\u002Fagentguard\u002Fblob\u002Fmain\u002Fbench\u002Fcorpus\u002Fbenign\u002Freal-hf-hf-cloud-python-env-setup\u002Fscripts\u002Fsetup_env.py",[61,68,73,78,83,89],{"skillNo":62,"name":63,"nameZh":6,"description":64,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":65,"categories":66,"keywords":67,"publishedAt":18},"01M7DJ7GBSJBJ32GXNQXVAMNYK","csv-tool","Summarize CSV files and report column statistics.","https:\u002F\u002Fgithub.com\u002Fak2dev\u002Fagentguard\u002Fblob\u002Fmain\u002Ffixtures\u002Frules\u002FAG-SYS-002\u002Fpositive\u002Ffault\u002Fcsv-tool\u002FSKILL.md",[],[],{"skillNo":69,"name":63,"nameZh":6,"description":64,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":70,"categories":71,"keywords":72,"publishedAt":18},"01M7DJ7F00PA7EHFM39RVCC8R5","https:\u002F\u002Fgithub.com\u002Fak2dev\u002Fagentguard\u002Fblob\u002Fmain\u002Ffixtures\u002Frules\u002FAG-SYS-002\u002Fnegative\u002Fnormal\u002Fcsv-tool\u002FSKILL.md",[],[],{"skillNo":74,"name":63,"nameZh":6,"description":64,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":75,"categories":76,"keywords":77,"publishedAt":18},"01M7DJ7DP7KDW7MYY5Q0R0JFEN","https:\u002F\u002Fgithub.com\u002Fak2dev\u002Fagentguard\u002Fblob\u002Fmain\u002Ffixtures\u002Frules\u002FAG-SYS-001\u002Fpositive\u002Ftoo-large\u002Fcsv-tool\u002FSKILL.md",[],[],{"skillNo":79,"name":63,"nameZh":6,"description":64,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":18},"01M7DJ7C3VA0KQ8Q9ESNX6AJHE","https:\u002F\u002Fgithub.com\u002Fak2dev\u002Fagentguard\u002Fblob\u002Fmain\u002Ffixtures\u002Frules\u002FAG-SYS-001\u002Fnegative\u002Fsmall\u002Fcsv-tool\u002FSKILL.md",[],[],{"skillNo":84,"name":85,"nameZh":6,"description":64,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":18},"01M7DJ7AQZTGY5YADQX73TRB7K","pdf","https:\u002F\u002Fgithub.com\u002Fak2dev\u002Fagentguard\u002Fblob\u002Fmain\u002Ffixtures\u002Frules\u002FAG-SKL-TYP-002\u002Fpositive\u002Fother-publisher\u002Fpdf\u002FSKILL.md",[],[],{"skillNo":90,"name":85,"nameZh":6,"description":64,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":91,"categories":92,"keywords":93,"publishedAt":18},"01M7DJ7831XDVWS4W9SAAKBJHX","https:\u002F\u002Fgithub.com\u002Fak2dev\u002Fagentguard\u002Fblob\u002Fmain\u002Ffixtures\u002Frules\u002FAG-SKL-TYP-002\u002Fnegative\u002Fsame-publisher\u002Fpdf\u002FSKILL.md",[],[]]