Skip to content

Commit 9afe1b5

Browse files
committed
use uv
1 parent e39ed50 commit 9afe1b5

5 files changed

Lines changed: 24 additions & 48 deletions

File tree

.github/unittest/linux_libs/scripts_procgen/environment.yml

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

.github/unittest/linux_libs/scripts_procgen/install.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ unset PYTORCH_VERSION
77

88
set -e
99

10-
# Note: This script is sourced by run_all.sh, so the environment is already active
10+
# Activate the virtual environment
11+
source ./env/bin/activate
1112

1213
if [ "${CU_VERSION:-}" == cpu ] ; then
1314
version="cpu"

.github/unittest/linux_libs/scripts_procgen/post_process.sh

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

33
set -e
44

5-
eval "$(./conda/bin/conda shell.bash hook)"
6-
conda activate ./env
5+
# Activate the virtual environment
6+
source ./env/bin/activate

.github/unittest/linux_libs/scripts_procgen/run_test.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
set -e
44

5-
eval "$(./conda/bin/conda shell.bash hook)"
6-
conda activate ./env
5+
# Activate the virtual environment
6+
source ./env/bin/activate
77

88
apt-get update && apt-get install -y git wget cmake
99

@@ -17,7 +17,7 @@ root_dir="$(git rev-parse --show-toplevel)"
1717
env_dir="${root_dir}/env"
1818
lib_dir="${env_dir}/lib"
1919

20-
conda deactivate && conda activate ./env
20+
deactivate 2>/dev/null || true && source ./env/bin/activate
2121

2222
# this workflow only tests the libs
2323
python -c "import procgen"

.github/unittest/linux_libs/scripts_procgen/setup_env.sh

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -33,37 +33,32 @@ 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+
curl -LsSf https://astral.sh/uv/install.sh | sh
44+
export PATH="$HOME/.local/bin:$PATH"
5145
fi
52-
eval "$(${conda_dir}/bin/conda shell.bash hook)"
5346

54-
# 2. Create test environment at ./env
47+
# Create virtual environment using uv
5548
printf "python: ${PYTHON_VERSION}\n"
5649
if [ ! -d "${env_dir}" ]; then
57-
printf "* Creating a test environment\n"
58-
conda create --prefix "${env_dir}" -y python="$PYTHON_VERSION"
50+
printf "* Creating a test environment with uv\n"
51+
uv venv "${env_dir}" --python "${PYTHON_VERSION}"
5952
fi
60-
conda activate "${env_dir}"
6153

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"
54+
# Activate the virtual environment
55+
source "${env_dir}/bin/activate"
6656

67-
pip3 install pip --upgrade
57+
# Upgrade pip
58+
uv pip install --upgrade pip
6859

69-
conda env update --file "${this_dir}/environment.yml" --prune
60+
# Install dependencies from requirements.txt
61+
printf "* Installing dependencies (except PyTorch)\n"
62+
if [ -f "${this_dir}/requirements.txt" ]; then
63+
uv pip install -r "${this_dir}/requirements.txt"
64+
fi

0 commit comments

Comments
 (0)