99
1010if [[ $OSTYPE != ' darwin' * ]]; then
1111 apt-get update && apt-get upgrade -y
12- apt-get install -y vim git wget cmake
12+ apt-get install -y vim git wget curl cmake
1313
1414 # Enable universe repository
1515 # apt-get install -y software-properties-common
4545# Avoid error: "fatal: unsafe repository"
4646git config --global --add safe.directory ' *'
4747root_dir=" $( git rev-parse --show-toplevel) "
48- conda_dir=" ${root_dir} /conda"
49- env_dir=" ${root_dir} /env"
50- lib_dir=" ${env_dir} /lib"
48+ env_dir=" ${root_dir} /.venv"
5149
5250cd " ${root_dir} "
5351
54- case " $( uname -s ) " in
55- Darwin * ) os=MacOSX;;
56- * ) os=Linux
57- esac
52+ # 1. Install uv
53+ printf " * Installing uv\n "
54+ curl -LsSf https://astral.sh/uv/install.sh | sh
55+ export PATH= " $HOME /.local/bin: $PATH "
5856
59- # 1. Install conda at ./conda
60- if [ ! -d " ${conda_dir} " ]; then
61- printf " * Installing conda\n"
62- wget -O miniconda.sh " http://repo.continuum.io/miniconda/Miniconda3-latest-${os} -x86_64.sh"
63- bash ./miniconda.sh -b -f -p " ${conda_dir} "
64- fi
65- eval " $( ${conda_dir} /bin/conda shell.bash hook) "
66-
67- # 2. Create test environment at ./env
57+ # 2. Create test environment at ./.venv
6858printf " python: ${PYTHON_VERSION} \n"
69- if [ ! -d " ${env_dir} " ]; then
70- printf " * Creating a test environment\n"
71- conda create --prefix " ${env_dir} " -y python=" $PYTHON_VERSION "
72- fi
73- conda activate " ${env_dir} "
59+ printf " * Creating a test environment with uv\n"
60+ uv venv " ${env_dir} " --python=" ${PYTHON_VERSION} "
61+ source " ${env_dir} /bin/activate"
7462
75- # 3. Install Conda dependencies
63+ # 3. Install dependencies (except PyTorch)
7664printf " * Installing dependencies (except PyTorch)\n"
77- echo " - python=${PYTHON_VERSION} " >> " ${this_dir} /environment.yml"
78- cat " ${this_dir} /environment.yml"
7965
8066if [ " ${CU_VERSION:- } " == cpu ] ; then
8167 export MUJOCO_GL=glfw
8571
8672export SDL_VIDEODRIVER=dummy
8773
88- # legacy from bash scripts: remove?
89- conda env config vars set \
90- MAX_IDLE_COUNT=1000 \
91- MUJOCO_GL=$MUJOCO_GL PYOPENGL_PLATFORM=$MUJOCO_GL DISPLAY=:99 SDL_VIDEODRIVER=dummy LAZY_LEGACY_OP=False RL_LOGGING_LEVEL=DEBUG TOKENIZERS_PARALLELISM=true
74+ # Set environment variables
75+ export MAX_IDLE_COUNT=1000
76+ export PYOPENGL_PLATFORM=$MUJOCO_GL
77+ export DISPLAY=:99
78+ export LAZY_LEGACY_OP=False
79+ export RL_LOGGING_LEVEL=DEBUG
80+ export TOKENIZERS_PARALLELISM=true
9281
93- pip3 install pip --upgrade
94- pip install virtualenv
82+ # Install dependencies from environment.yml using uv
83+ uv pip install hypothesis future cloudpickle pygame " moviepy<2.0.0" tqdm \
84+ pytest pytest-cov pytest-mock pytest-instafail pytest-rerunfailures \
85+ pytest-timeout pytest-asyncio expecttest " pybind11[global]" pyyaml scipy \
86+ hydra-core tensorboard " imageio==2.26.0" wandb dm_control " mujoco<3.3.6" \
87+ mlflow av coverage ray transformers ninja timm protobuf
9588
96- conda env update --file " ${this_dir} /environment.yml" --prune
97-
98- # Reset conda env variables
99- conda deactivate
100- conda activate " ${env_dir} "
89+ # Install pip for compatibility with packages that expect it
90+ uv pip install pip
10191
10292echo " installing gymnasium"
10393if [[ " $PYTHON_VERSION " == " 3.12" ]]; then
104- pip3 install ale-py
105- pip3 install sympy
106- pip3 install " gymnasium[mujoco]>=1.1" mo-gymnasium[mujoco]
94+ uv pip install ale-py
95+ uv pip install sympy
96+ uv pip install " gymnasium[mujoco]>=1.1" mo-gymnasium[mujoco]
10797else
108- pip3 install " gymnasium[atari,mujoco]>=1.1" mo-gymnasium[mujoco]
98+ uv pip install " gymnasium[atari,mujoco]>=1.1" mo-gymnasium[mujoco]
10999fi
110100
111101# sanity check: remove?
@@ -140,15 +130,15 @@ git submodule sync && git submodule update --init --recursive
140130printf " Installing PyTorch with %s\n" " ${CU_VERSION} "
141131if [[ " $TORCH_VERSION " == " nightly" ]]; then
142132 if [ " ${CU_VERSION:- } " == cpu ] ; then
143- pip3 install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cpu -U
133+ uv pip install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/cpu -U
144134 else
145- pip3 install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/$CU_VERSION -U
135+ uv pip install --pre torch torchvision --index-url https://download.pytorch.org/whl/nightly/$CU_VERSION -U
146136 fi
147137elif [[ " $TORCH_VERSION " == " stable" ]]; then
148138 if [ " ${CU_VERSION:- } " == cpu ] ; then
149- pip3 install torch torchvision --index-url https://download.pytorch.org/whl/cpu -U
139+ uv pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu -U
150140 else
151- pip3 install torch torchvision --index-url https://download.pytorch.org/whl/$CU_VERSION -U
141+ uv pip install torch torchvision --index-url https://download.pytorch.org/whl/$CU_VERSION -U
152142 fi
153143else
154144 printf " Failed to install pytorch"
@@ -167,14 +157,13 @@ python -c "import functorch"
167157
168158# install tensordict
169159if [[ " $RELEASE " == 0 ]]; then
170- pip3 install git+https://github.com/pytorch/tensordict.git
160+ uv pip install git+https://github.com/pytorch/tensordict.git
171161else
172- pip3 install tensordict
162+ uv pip install tensordict
173163fi
174164
175165printf " * Installing torchrl\n"
176- python setup.py develop
177-
166+ uv pip install -e . --no-build-isolation
178167
179168if [ " ${CU_VERSION:- } " != cpu ] ; then
180169 printf " * Installing VC1\n"
0 commit comments