build-and-dependency

Set up Megatron-LM GPU environments and resolve uv.lock dependency conflicts.

Updated May 23, 2026
One-click install
npx skills add https://github.com/yo-steven/skills-exploration-20260522 --skill build-and-dependency-yo-steven
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: build-and-dependency
Source: https://github.com/yo-steven/skills-exploration-20260522/tree/main/skills/Megatron-Core/build-and-dependency
Command: npx skills add https://github.com/yo-steven/skills-exploration-20260522 --skill build-and-dependency-yo-steven

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It solves the problem of setting up a reliable, reproducible development environment for Megatron-LM with GPU-dependent CUDA/NCCL/PyTorch and native extensions, where host installation is fragile and results vary across machines.

Core Features & Use Cases

  • Container-based development environment: Uses the CI container image that already includes the correct CUDA toolkit, PyTorch build, and pre-compiled native extensions to reduce setup failures.
  • uv-driven dependency management: Installs and updates dependencies via uv sync with locked resolution, supports multiple dependency groups, and prevents mismatch between local and CI environments.
  • Safe dependency change workflow: Provides a practical process for adding new dependencies, regenerating uv.lock, and resolving uv.lock merge conflicts without manual editing.

Quick Start

Use the build-and-dependency skill to set up your Megatron-LM dev container and run uv sync using the correct dependency groups for your change.

Frequently Asked Questions about build-and-dependency

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up a reproducible Megatron-LM development environment with CUDA?

To set up a reproducible Megatron-LM environment, use the CI container image that already includes the correct CUDA toolkit, PyTorch build, and pre-compiled native extensions, ensuring consistent GPU-ready dependency resolution across machines.

How do I resolve uv.lock merge conflicts when updating Megatron-LM dependencies?

To resolve uv.lock merge conflicts safely, avoid manual editing and use the container-based workflow to run `uv lock` after changes to pyproject.toml, regenerating the locked resolution without causing local and CI environment mismatches.

Why does uv sync fail to install GPU-dependent packages for Megatron-LM on my host machine?

Host installation of GPU-dependent CUDA, NCCL, and PyTorch packages is fragile and varies across machines, so you must run all uv operations inside the container’s /opt/venv environment using the pinned CI container build stages to prevent setup failures.

What is the best way to add a new dependency to a Megatron-LM project using uv?

The best way to add a dependency is updating pyproject.toml and running `uv lock` inside the container to regenerate uv.lock, followed by `uv sync` with the correct dependency groups to maintain a safe dependency change workflow.

Can I use uv to manage multiple dependency groups for Megatron-LM containers?

Yes, uv-driven dependency management supports installing and updating dependencies via `uv sync` with locked resolution across multiple dependency groups, ensuring consistent environments inside the container's /opt/venv.

How do I fix common container or uv errors during Megatron-LM installation?

To fix common container or uv errors during installation and module import, use the pinned CI container build stages and execute all uv operations inside the container’s /opt/venv environment to ensure native extensions match the expected CUDA toolkit.