Skip to content

Commit d81b32f

Browse files
committed
conda -> uv
1 parent 40d54df commit d81b32f

File tree

10 files changed

+79
-73
lines changed

10 files changed

+79
-73
lines changed

.github/unittest/linux_libs/scripts_minari/environment.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

.github/unittest/linux_libs/scripts_minari/install.sh

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ unset PYTORCH_VERSION
77

88
set -e
99

10-
eval "$(./conda/bin/conda shell.bash hook)"
11-
conda activate ./env
10+
# Note: This script is sourced by run_all.sh, so the environment is already active
1211

1312
if [ "${CU_VERSION:-}" == cpu ] ; then
1413
version="cpu"
@@ -22,22 +21,21 @@ else
2221
version="$(python -c "print('.'.join(\"${CUDA_VERSION}\".split('.')[:2]))")"
2322
fi
2423

25-
2624
# submodules
2725
git submodule sync && git submodule update --init --recursive
2826

2927
printf "Installing PyTorch with cu128"
3028
if [[ "$TORCH_VERSION" == "nightly" ]]; then
3129
if [ "${CU_VERSION:-}" == cpu ] ; then
32-
pip3 install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu -U
30+
uv pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cpu -U
3331
else
34-
pip3 install --pre torch --index-url https://download.pytorch.org/whl/nightly/cu128 -U
32+
uv pip install --pre torch --index-url https://download.pytorch.org/whl/nightly/cu128 -U
3533
fi
3634
elif [[ "$TORCH_VERSION" == "stable" ]]; then
3735
if [ "${CU_VERSION:-}" == cpu ] ; then
38-
pip3 install torch --index-url https://download.pytorch.org/whl/cpu
36+
uv pip install torch --index-url https://download.pytorch.org/whl/cpu
3937
else
40-
pip3 install torch --index-url https://download.pytorch.org/whl/cu128
38+
uv pip install torch --index-url https://download.pytorch.org/whl/cu128
4139
fi
4240
else
4341
printf "Failed to install pytorch"
@@ -46,9 +44,9 @@ fi
4644

4745
# install tensordict
4846
if [[ "$RELEASE" == 0 ]]; then
49-
pip3 install git+https://github.com/pytorch/tensordict.git
47+
uv pip install git+https://github.com/pytorch/tensordict.git
5048
else
51-
pip3 install tensordict
49+
uv pip install tensordict
5250
fi
5351

5452
# smoke test

.github/unittest/linux_libs/scripts_minari/post_process.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@
22

33
set -e
44

5-
eval "$(./conda/bin/conda shell.bash hook)"
6-
conda activate ./env
5+
# Note: This script is sourced by run_all.sh, so the environment is already active
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
hypothesis
2+
future
3+
cloudpickle
4+
pytest
5+
pytest-cov
6+
pytest-mock
7+
pytest-instafail
8+
pytest-rerunfailures
9+
pytest-error-for-skips
10+
pytest-asyncio
11+
expecttest
12+
pybind11[global]
13+
pyyaml
14+
scipy
15+
hydra-core
16+
minari[gcs,hdf5,hf,create]
17+
gymnasium<1.0.0
18+
ale-py
19+
gymnasium-robotics
20+
mujoco
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env bash
2+
3+
set -euxo pipefail
4+
5+
# Run all minari test scripts in sequence, sourcing each one to maintain environment state
6+
this_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
7+
8+
echo "Running minari tests with uv-based setup..."
9+
10+
# Source each script in sequence to maintain environment state
11+
source "${this_dir}/setup_env.sh"
12+
source "${this_dir}/install.sh"
13+
source "${this_dir}/run_test.sh"
14+
source "${this_dir}/post_process.sh"
15+
16+
echo "Minari tests completed successfully!"

.github/unittest/linux_libs/scripts_minari/run_test.sh

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
set -e
44

5-
eval "$(./conda/bin/conda shell.bash hook)"
6-
conda activate ./env
5+
# Note: This script is sourced by run_all.sh, so the environment is already active
76

87
apt-get update && apt-get remove swig -y && apt-get install -y git gcc patchelf libosmesa6-dev libgl1-mesa-glx libglfw3 swig3.0 cmake
98
ln -s /usr/bin/swig3.0 /usr/bin/swig
@@ -18,8 +17,6 @@ root_dir="$(git rev-parse --show-toplevel)"
1817
env_dir="${root_dir}/env"
1918
lib_dir="${env_dir}/lib"
2019

21-
conda deactivate && conda activate ./env
22-
2320
# this workflow only tests the libs
2421
python -c "import minari"
2522

.github/unittest/linux_libs/scripts_minari/setup_env.sh

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -33,37 +33,40 @@ apt-get upgrade -y libstdc++6
3333

3434
this_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
3535
root_dir="$(git rev-parse --show-toplevel)"
36-
conda_dir="${root_dir}/conda"
3736
env_dir="${root_dir}/env"
3837

3938
cd "${root_dir}"
4039

41-
case "$(uname -s)" in
42-
Darwin*) os=MacOSX;;
43-
*) os=Linux
44-
esac
45-
46-
# 1. Install conda at ./conda
47-
if [ ! -d "${conda_dir}" ]; then
48-
printf "* Installing conda\n"
49-
wget -O miniconda.sh "http://repo.continuum.io/miniconda/Miniconda3-latest-${os}-x86_64.sh"
50-
bash ./miniconda.sh -b -f -p "${conda_dir}"
40+
# Install uv if not already installed
41+
if ! command -v uv &> /dev/null; then
42+
printf "* Installing uv\n"
43+
# Try different Python commands
44+
if command -v python3 &> /dev/null; then
45+
python3 -m pip install uv
46+
elif command -v python &> /dev/null; then
47+
python -m pip install uv
48+
else
49+
# Fallback to curl installation
50+
curl -LsSf https://astral.sh/uv/install.sh | sh
51+
export PATH="$HOME/.local/bin:$PATH"
52+
fi
5153
fi
52-
eval "$(${conda_dir}/bin/conda shell.bash hook)"
5354

54-
# 2. Create test environment at ./env
55+
# Create virtual environment using uv
5556
printf "python: ${PYTHON_VERSION}\n"
5657
if [ ! -d "${env_dir}" ]; then
57-
printf "* Creating a test environment\n"
58-
conda create --prefix "${env_dir}" -y python="$PYTHON_VERSION"
58+
printf "* Creating a test environment with uv\n"
59+
uv venv "${env_dir}" --python "${PYTHON_VERSION}"
5960
fi
60-
conda activate "${env_dir}"
6161

62-
# 3. Install Conda dependencies
63-
printf "* Installing dependencies (except PyTorch)\n"
64-
echo " - python=${PYTHON_VERSION}" >> "${this_dir}/environment.yml"
65-
cat "${this_dir}/environment.yml"
62+
# Activate the virtual environment
63+
source "${env_dir}/bin/activate"
6664

67-
pip3 install pip --upgrade
65+
# Upgrade pip
66+
uv pip install --upgrade pip
6867

69-
conda env update --file "${this_dir}/environment.yml" --prune
68+
# Install dependencies from requirements.txt (we'll create this)
69+
printf "* Installing dependencies (except PyTorch)\n"
70+
if [ -f "${this_dir}/requirements.txt" ]; then
71+
uv pip install -r "${this_dir}/requirements.txt"
72+
fi

.github/workflows/test-linux-libs.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -466,10 +466,7 @@ jobs:
466466
export BATCHED_PIPE_TIMEOUT=60
467467
export TD_GET_DEFAULTS_TO_NONE=1
468468
469-
bash .github/unittest/linux_libs/scripts_minari/setup_env.sh
470-
bash .github/unittest/linux_libs/scripts_minari/install.sh
471-
bash .github/unittest/linux_libs/scripts_minari/run_test.sh
472-
bash .github/unittest/linux_libs/scripts_minari/post_process.sh
469+
bash .github/unittest/linux_libs/scripts_minari/run_all.sh
473470
474471
unittests-openx:
475472
strategy:

packaging/build_wheels.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
77
export BUILD_TYPE=wheel
88
setup_env
99
setup_wheel_python
10-
pip_install numpy pyyaml future ninja
10+
pip_install numpy pyyaml future ninja "pybind11[global]"
1111
pip_install --upgrade setuptools
1212
setup_pip_pytorch_version
1313
python setup.py clean

test/test_libs.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3343,13 +3343,13 @@ def test_d4rl_iteration(self, task, split_trajs):
33433343

33443344
MUJOCO_ENVIRONMENTS = [
33453345
"Hopper-v5",
3346-
"Pusher-v5",
3346+
"Pusher-v4",
33473347
"Humanoid-v5",
33483348
"InvertedDoublePendulum-v5",
33493349
"HalfCheetah-v5",
33503350
"Swimmer-v5",
33513351
"Walker2d-v5",
3352-
"Ant-v5",
3352+
"ALE/Ant-v5",
33533353
"Reacher-v5",
33543354
]
33553355

@@ -3421,7 +3421,7 @@ def get_random_minigrid_datasets():
34213421
]
34223422

34233423
# 3 random datasets
3424-
indices = torch.randperm(len(all_minigrid))[:3]
3424+
indices = torch.randperm(len(all_minigrid))[:3]
34253425
return [all_minigrid[idx] for idx in indices]
34263426

34273427

@@ -3488,7 +3488,7 @@ class TestMinari:
34883488
@pytest.mark.parametrize(
34893489
"dataset_idx",
34903490
# Only use a static upper bound; do not call any function that imports minari globally.
3491-
range(7)
3491+
range(4),
34923492
)
34933493
def test_load(self, dataset_idx, split):
34943494
"""
@@ -3499,11 +3499,11 @@ def test_load(self, dataset_idx, split):
34993499

35003500
num_custom_to_select = 4
35013501
custom_envs = MUJOCO_ENVIRONMENTS + D4RL_ENVIRONMENTS
3502-
3502+
35033503
# Randomly select a subset of custom environments
35043504
indices = torch.randperm(len(custom_envs))[:num_custom_to_select]
35053505
custom_envs_subset = [custom_envs[i] for i in indices]
3506-
3506+
35073507
num_custom = len(custom_envs_subset)
35083508
try:
35093509
minigrid_datasets = get_random_minigrid_datasets()
@@ -3681,6 +3681,7 @@ def test_local_minari_dataset_loading(self):
36813681

36823682
minari.delete_dataset(dataset_id="cartpole/test-local-v1")
36833683

3684+
36843685
@pytest.mark.slow
36853686
class TestRoboset:
36863687
def test_load(self):

0 commit comments

Comments
 (0)