[Question] Is there a build_uv.sh to build the environment with uv?
Open
Nobody has claimed this yet.
question
- Dominant language
- Python
- Stars
- 8.5k
- Forks
- 1.3k
- Avg merge
- 5h 36m
- Merged PRs (30d)
- 22
Description
Your Question
I use uv to manage my environment, and I write a bash script to build with uv.
Will slime add a build_uv.sh?
My script:
#!/bin/bash
set -ex
export SGLANG_COMMIT="bbe9c7eeb520b0a67e92d133dfc137a3688dc7f2"
export MEGATRON_COMMIT="3714d81d418c9f1bca4594fc35f9e8289f652862"
export BASE_DIR=${BASE_DIR:-"/root"}
cd $BASE_DIR
# create venv with uv
uv venv slime-venv --python 3.12
source $BASE_DIR/slime-venv/bin/activate
# CUDA_HOME should point to system CUDA 12.9 on the target B200 machine
# Adjust this path if your CUDA installation is elsewhere
export CUDA_HOME=${CUDA_HOME:-"/usr/local/cuda-12.9"}
export PATH="$CUDA_HOME/bin:$PATH"
export LD_LIBRARY_PATH="$CUDA_HOME/lib64:$LD_LIBRARY_PATH"
# prevent installing cuda 13.0 for sglang
uv pip install cuda-python==13.1.0
uv pip install torch==2.9.1 torchvision==0.24.1 torchaudio==2.9.1 --index-url https://download.pytorch.org/whl/cu129
# install sglang
if [ ! -d "$BASE_DIR/sglang" ]; then
git clone https://github.com/sgl-project/sglang.git
fi
cd $BASE_DIR/sglang
git checkout ${SGLANG_COMMIT}
# Install the python packages
uv pip install wheel
uv pip install -e "python[all]"
uv pip install cmake ninja
# flash attn
# the newest version megatron supports is v2.7.4.post1
MAX_JOBS=64 uv pip install -v flash-attn==2.7.4.post1 --no-build-isolation
uv pip install git+https://github.com/ISEEKYAN/mbridge.git@89eb10887887bc74853f89a4de258c0702932a1c --no-deps
uv pip install --no-build-isolation "transformer_engine[pytorch]==2.10.0"
uv pip install flash-linear-attention==0.4.1
uv pip install pip
NVCC_APPEND_FLAGS="--threads 4" \
pip -v install --disable-pip-version-check --no-cache-dir \
--no-build-isolation \
--config-settings "--build-option=--cpp_ext --cuda_ext --parallel 8" git+https://github.com/NVIDIA/apex.git@10417aceddd7d5d05d7cbf7b0fc2daad1105f8b4
uv pip install poetry pybind11
uv pip install git+https://github.com/fzyzcjy/torch_memory_saver.git@dc6876905830430b5054325fa4211ff302169c6b --no-cache --reinstall-package torch-memory-saver
uv pip install git+https://github.com/fzyzcjy/Megatron-Bridge.git@dev_rl --no-build-isolation
uv pip install "nvidia-modelopt[torch]>=0.37.0" --no-build-isolation
# megatron
cd $BASE_DIR
if [ ! -d "$BASE_DIR/Megatron-LM" ]; then
git clone https://github.com/NVIDIA/Megatron-LM.git --recursive
fi
cd Megatron-LM/ && git checkout ${MEGATRON_COMMIT}
uv pip install -e .
# install slime and apply patches
if [ ! -d "$BASE_DIR/slime" ]; then
cd $BASE_DIR
git clone https://github.com/THUDM/slime.git
cd slime/
export SLIME_DIR=$BASE_DIR/slime
uv pip install -e .
else
export SLIME_DIR=$BASE_DIR/slime
cd $SLIME_DIR
uv pip install -e .
fi
# https://github.com/pytorch/pytorch/issues/168167
uv pip install nvidia-cudnn-cu12==9.16.0.29
uv pip install "numpy<2"
# apply patch
cd $BASE_DIR/sglang
git apply $SLIME_DIR/docker/patch/v0.5.9/sglang.patch
cd $BASE_DIR/Megatron-LM
git apply $SLIME_DIR/docker/patch/v0.5.9/megatron.patch
What I've Tried
- I browse the repo but find no build_uv.sh
Environment (if relevant)
- slime version:
- Python version:
- PyTorch version:
- CUDA/ROCm version:
- GPU type and count:
- OS:
Additional Context
No response
Pre-submission Checklist
- I have read the CONTRIBUTING.md and understand the collaboration scope.
- I have read the documentation and FAQ and my question is not answered there.
- I have searched for existing issues and my question has not been asked before.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the repository's existing environment and build entry points, especially the docker/patch/v0.5.9 paths named in the script, then compare them with the proposed uv-based setup. A complete change would establish whether a maintained build_uv.sh belongs in the project and make the supported uv environment reproducible.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, python, shell
- Domain
- build-system, devops
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100