nlp-research-repo-package-installment
Align Python version and repo-declared dependencies (requirements.txt / environment.yml) before installing packages for NLP research code reproduction.
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-14
- Stars
- ★ 0
- Forks
- 1
01 前言 Front Matter
- name
- nlp-research-repo-package-installment
- version
- 1.0
- description
- Align Python version and repo-declared dependencies (requirements.txt / environment.yml) before installing packages for NLP research code reproduction.
03 SKILL.md 正文
NLP Research Repo Package Installment
When reproducing an NLP research repo, always align the environment to the repo’s declared dependencies first. Most failures come from Python version mismatch or installing packages without following requirements.txt / environment.yml.
What to do (must run before any install)
- Read the repo dependency files
- Prefer
environment.yml/environment.yaml(often pins Python + channels + non-pip deps) - Otherwise use
requirements.txt(pip deps) - If both exist, treat
environment.ymlas the base,requirements.txtas supplemental unless README says otherwise
- Log the current environment (Python version is critical)
Write/root/python_int.txtcontaining:
python -VV(required; Python version is often the root cause)python -m pip --versionpython -m pip freeze
Interpreter lockstep rule (prevents “wrong Python in logs”)
In sandboxes with multiple Pythons (system Python + uv/venv/conda), never assume
pythonon PATH is the interpreter you’ll actually use. Before you log provenance files (and before installs/tests), bind to one interpreter identity and use it everywhere:
Prefer an absolute interpreter path for all three phases: installs, running tests/scripts, and writing environment info. Example pattern:
PY=/opt/py310/bin/python(or your venv’s.../bin/python)$PY -VV > /root/python_info.txt$PY -m pip freeze >> /root/python_info.txt$PY -m pytest ...(or$PY path/to/script.py)If you rely on PATH/activation instead, verify the binding right before logging:
which pythonandpython -VVshould match the intended pinned version.Artifact contract note: if the task specifies an exact output path/name (e.g.,
/root/python_info.txt) or required substrings (e.g., it must mentionpython 3.10), follow the task contract even if this skill uses a different default filename.Verification/fallback: after writing the file, confirm it matches the intended interpreter:
head -n 1 /root/python_info.txtshould show the expected major/minor.- If it doesn’t, rewrite the file using the correct interpreter’s absolute path.
- Compare & decide
-
If the repo expects a specific Python major/minor and the current Python does not match, it’s usually best to set up a matching environment before installing dependencies. Example: set up a fresh Python 3.11 environment (Docker / Ubuntu) with uv # Install uv apt-get update apt-get install -y --no-install-recommends curl ca-certificates rm -rf /var/lib/apt/lists/* curl -LsSf https://astral.sh/uv/0.9.7/install.sh | sh export PATH="/root/.local/bin:$PATH"
# Install Python + create a venv uv python install 3.11.8 uv venv --python 3.11.8 /opt/py311 # Use the new Python for installs/runs /opt/py311/bin/python -VV /opt/py311/bin/python -m pip install -U pip setuptools wheel -
Prefer installing from the repo’s dependency files (avoid random upgrades), then run a quick import/smoke test.
04 同仓库更多 Skills
video-frame-extraction
Extract frames from video files and save them as images using OpenCV
openai-vision
Analyze images and multi-frame sequences using OpenAI GPT vision models
image-ocr
Extract text content from images using Tesseract OCR via Python, including structured field extraction from receipts and forms
video-frame-extraction
Extract frames from video files and save them as images using OpenCV
openai-vision
Analyze images and multi-frame sequences using OpenAI GPT vision models
image-ocr
Extract text content from images using Tesseract OCR via Python, including structured field extraction from receipts and forms